Best SMTP Settings for Reliable Email Delivery in 2025
The exact ports, encryption modes, authentication, and timeouts to use for production SMTP — plus a copy-paste config for the top providers.
The exact ports, encryption modes, authentication, and timeouts to use for production SMTP — plus a copy-paste config for the top providers.
For almost every production workload in 2025 you want port 587 with STARTTLS and AUTH LOGIN over an encrypted channel, or port 465 with implicit TLS if your library supports it cleanly. Port 25 is reserved for server-to-server relay and is widely blocked for outbound use.
That single line will solve 80 percent of "my email is not sending" tickets. The rest of this guide explains the why and the edge cases.
| Port | Encryption | Use case |
|---|---|---|
| 25 | Optional | MTA-to-MTA relay only |
| 465 | Implicit TLS | Submission, broadly supported again |
| 587 | STARTTLS | Modern submission, the default for most |
| 2525 | STARTTLS | Fallback when 587/465 are firewall-blocked |
Cloud platforms like AWS, GCP, and many residential ISPs block outbound port 25. If your application runs in a VPC and SMTP suddenly stops working after a migration, the firewall is usually the cause.
A quick way to tell a firewall block from a server problem: a firewall drop hangs until your timeout expires, while a server refusal returns a reply string almost immediately. If SMTPTester reports "connection timed out" rather than a numeric code, stop debugging credentials and go look at your egress rules.
Both deliver the same protection when correctly configured. The historical argument against STARTTLS was that a man-in-the-middle could strip the upgrade, but every serious client now enforces *require TLS* and aborts the session if the upgrade fails.
Use STARTTLS (587) when:
Use implicit TLS (465) when:
Whichever you choose, insist on TLS 1.2 as a floor and prefer TLS 1.3. Disable SSLv3 and TLS 1.0/1.1 entirely — they fail modern compliance audits and provide no interoperability benefit in 2025.
The most common self-inflicted security hole in email code is rejectUnauthorized: false (or its equivalent in Python, PHP, and Java). It disables hostname and chain verification, turning an encrypted channel into one any network operator can silently intercept.
If certificate validation fails, the correct fixes are:
None of those are "turn verification off".
Prefer AUTH LOGIN or AUTH PLAIN over an encrypted channel for password-based credentials. For OAuth-protected mailboxes (Gmail Workspace, Microsoft 365 with modern auth), use XOAUTH2 and refresh the token before each batch.
Never enable AUTH CRAM-MD5 as a primary mechanism — it predates modern TLS and forces the server to store passwords in a recoverable form.
Credential hygiene matters as much as mechanism choice:
Real-world SMTP problems usually surface under load, not in tests. Production defaults to use:
Add jittered exponential backoff for 4xx replies: 1s, 2s, 4s, 8s, up to a cap of about five minutes. Retrying instantly and in lockstep across workers creates a thundering herd that providers interpret as abuse.
The SMTP layer accepts your connection. The deliverability layer decides whether the message reaches the inbox. Three records are non-negotiable in 2025:
p=none, monitor reports, then move to p=quarantine or p=reject).Gmail and Yahoo now reject high-volume mail that fails DMARC alignment. There is no workaround.
Two additional records are quickly becoming expected: MTA-STS, which tells receiving servers to require TLS for your domain, and TLS-RPT, which delivers reports when a TLS connection to your domain fails. Neither affects inbox placement directly, but both signal an operationally mature sender.
Settings are not only about transport. These message-level defaults prevent a large share of spam-folder placement:
Reply-To and a real, monitored From address — never noreply@ if you can avoid it.List-Unsubscribe and List-Unsubscribe-Post headers on bulk mail; both Gmail and Yahoo now require one-click unsubscribe for bulk senders.Message-ID domain that matches your sending domain.Gmail: smtp.gmail.com:587 STARTTLS, app password
M365: smtp.office365.com:587 STARTTLS, UPN
SendGrid: smtp.sendgrid.net:587 STARTTLS, "apikey" + API key
Mailgun: smtp.mailgun.org:587 STARTTLS, postmaster@domain
Amazon SES: email-smtp.<region>.amazonaws.com:587 STARTTLS, SMTP credentials
Postmark: smtp.postmarkapp.com:587 STARTTLS, server token as both user/pass
Zoho: smtp.zoho.com:465 SSL, full email address
Brevo: smtp-relay.brevo.com:587 STARTTLS, login + SMTP key
Fastmail: smtp.fastmail.com:465 SSL, app passwordOne of the highest-return configuration decisions has nothing to do with ports. Send transactional mail (password resets, receipts, alerts) and marketing mail from different subdomains, ideally through different IP pools.
Transactional mail earns excellent engagement and reputation. Marketing mail inevitably attracts complaints. Mixing them means a bad campaign can push password-reset emails into spam — a support catastrophe. Using mail.yourdomain.com for transactional and news.yourdomain.com for marketing isolates the reputations cleanly.
New IPs and new domains have no reputation, and mailbox providers treat unknown senders with suspicion. A sensible warm-up curve for a dedicated IP looks roughly like this:
| Day | Volume |
|---|---|
| 1–2 | 50–100 |
| 3–5 | 500 |
| 6–10 | 2,000 |
| 11–15 | 10,000 |
| 16–25 | 50,000 |
| 26+ | Full volume |
Send to your most engaged recipients first. Engagement early in the warm-up teaches filters that your mail is wanted.
Wire these into the same dashboard as your application metrics. Email problems are usually noticed by customers first because nobody is watching the numbers.
Before you ship a change to mail configuration, confirm every line:
Run every change through SMTPTester before deploying. A 30-second test that confirms the connection, TLS negotiation, and authentication will save hours of customer-support work later — and running it from the same network your application uses catches the firewall issues that a laptop test would hide.
Two infrastructure details cause failures that look like configuration problems.
IPv6. If your server has an IPv6 address and your provider's hostname has an AAAA record, connections will prefer IPv6. Many receiving networks apply stricter policies to IPv6 senders, and some require a matching reverse DNS record that you may not have configured. If mail works from one host and fails from another with otherwise identical settings, check whether one is connecting over IPv6.
EHLO hostname. Your client identifies itself in the EHLO command. Libraries default to the machine's hostname, which in a container is often something meaningless like a3f9c2e1b004. Set it explicitly to a fully qualified domain name you control. Some receiving servers reject an EHLO argument that is not a valid FQDN, and the resulting 550 gives no hint about the cause.
This decision has more impact on deliverability than any timeout value.
Shared IP pools are the right default below roughly 100,000 messages per month. Your volume alone is too low to establish a reputation, and riding on a well-managed pool borrows the provider's established standing. The trade-off is that another sender's behaviour affects you, though reputable providers police their pools aggressively.
Dedicated IPs make sense above that threshold, or when you need complete control and predictability. You own the reputation entirely — good and bad. A dedicated IP with low or irregular volume performs *worse* than a shared pool, because inconsistent sending never builds a stable signal.
If you take a dedicated IP, take at least two and keep them in the same pool so a single-IP outage does not stop mail.
The settings above assume your application is not sending mail synchronously inside a web request. If it is, fix that first.
A sensible architecture puts a durable queue between the application and the SMTP transport:
Web request -> enqueue job -> worker -> SMTP transport -> providerThis gives you three things that no SMTP setting can provide: requests that do not block on network latency, retries that survive a process restart, and a natural place to enforce rate limits and suppression checks.
Make jobs idempotent by attaching a deduplication key, so a retried job cannot send the same receipt twice. Store the provider's message ID on the originating record when the send succeeds, so support tickets can be traced without guessing.
Mail settings drift. Someone changes a port in a staging environment to work around a firewall, and six months later nobody remembers why production and staging differ.
Keep the whole configuration in version control: host, port, encryption mode, minimum TLS version, timeouts, pool size, and the name of the secret (never its value). Review changes like any other code change. Add an automated test that asserts the production configuration uses port 587 or 465, requires TLS, and has certificate verification enabled — a five-line test that permanently prevents the most dangerous misconfiguration.
Provider requirements change. Set a recurring reminder to check four things:
Fifteen minutes a quarter prevents the surprise that arrives as a deprecation notice you never read.
Apply what you just learned. Free, no signup, results in seconds.
Open the tool →A complete guide to testing SMTP servers — online testing, telnet and openssl commands, TLS verification, authentication checks and a repeatable diagnostic workflow.
DeliverabilityHow bounces work, the difference between hard and soft bounces, how to parse DSN messages, build a suppression list, and keep bounce rates under control.