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.
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:
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.
Real-world SMTP problems usually surface under load, not in tests. Production defaults to use:
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.
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 addressRun 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.
Apply what you just learned. Free, no signup, results in seconds.
Open the tool →A practical, copy-paste friendly guide to debugging SMTP authentication failures across Gmail, Microsoft 365, SendGrid, and self-hosted servers.
ArchitectureA pragmatic comparison of SMTP relay and HTTP API based email sending — performance, observability, deliverability, and when to pick each.