SMTP Port 465 vs 587 vs 2525: Which to Use
SMTP port 465 vs 587 explained: implicit TLS vs STARTTLS, where 2525 fits, why port 25 fails on Cloudflare Workers, and how to fix 535 login errors.
The Send As Team
4 min read
SMTP port 465 uses implicit TLS (encrypted from the first byte) and port 587 uses STARTTLS (starts plain, then upgrades before login). Both are secure; use the one your provider documents and match the security mode to it. Port 2525 is an alternative STARTTLS port, and port 25 is not usable from Cloudflare Workers.
These ports matter more now because Google’s notice says Gmail’s Send mail as for non-Google accounts ends in January 2027. People who used Gmail to send through their host’s SMTP server are re-entering those SMTP details in another tool, and getting the port and security pair wrong is the most common mistake.
Implicit TLS vs STARTTLS: what’s the difference?
- Implicit TLS (SSL/TLS): the client opens the connection and negotiates encryption immediately. Conventionally port 465.
- STARTTLS: the client connects, the server says it supports encryption, and the client upgrades the same connection before sending any password. Conventionally port 587.
Either protects your login and message in transit. The risk is a client that carries on without encryption if the upgrade fails. The Send As relay does not do that: with STARTTLS, if the server does not offer it, the relay stops before sending your password.
Port comparison
| Port | Mode | Typical use | Works from the Send As relay? |
|---|---|---|---|
| 25 | Server-to-server, often unencrypted | Mail between servers | No; not available to Cloudflare Workers |
| 465 | Implicit TLS (tls) |
Authenticated sending | Yes |
| 587 | STARTTLS (starttls) |
Authenticated sending (“submission”) | Yes |
| 2465 | Implicit TLS on an alternative port | Some providers | Yes |
| 2525 | STARTTLS on an alternative port | Used when 587 is blocked | Yes |
Some providers use unusual ports in unusual modes, so follow their page. In our SMTP presets, for example, Resend’s 2465 is listed as implicit TLS.
What values does the relay take?
The relay uses two settings that must agree:
SMTP_PORT:465or587(2465and2525also work).SMTP_SECURITY:tlsfor implicit SSL/TLS (port 465, and a few providers on 2465), orstarttlsfor 587 and 2525.
Typical pairs: 465 with tls; 587 with starttls; 2525 with starttls. If your provider’s page says SSL/TLS, choose tls; if it says STARTTLS, choose starttls.
Why can’t I use port 25?
Port 25 is meant for servers handing mail to each other, and many networks block it for consumers. Cloudflare Workers also cannot use it for outbound connections, so a relay built on Workers cannot send through port 25. Any decent provider offers 465 or 587 instead. If a provider documents only 25, pick another provider or one that supports a submission port.
When does 2525 help?
Some networks block 587. Providers such as Brevo, SMTP2GO, Mailjet, Mailgun and Postmark list 2525 as an alternative STARTTLS port (see the presets table, checked 2026-12-01). It is not an official standard port, so use it only when your provider lists it.
How do I troubleshoot a 535 login error?
A 535 means the server rejected your credentials. Work through these:
- Use an app password or SMTP key. Yahoo, AOL, iCloud and Fastmail require an app-specific password, and transactional providers use keys. Your normal password usually fails.
- Check the username. Often the full email address, but Resend uses
resend, SendGrid usesapikeyand Brevo uses an SMTP login that is not always your email. - Match port and security. Mismatches cause TLS errors or “server doesn’t offer STARTTLS”.
- Check SMTP is enabled for the account, for example Microsoft 365 can disable SMTP AUTH.
- Use the right host name. On shared hosting a certificate error often means you should use the server’s host name rather than
mail.yourbiz.com(cPanel guide).
How do I know which port my provider wants?
Look for the provider’s “email client settings” or “SMTP settings” page; it normally lists the host, port, security type and username. Our SMTP presets collect these for common providers and link each source page. Where we could not verify a value, the table says so rather than guessing, so treat any blank as “check the provider’s page”.
A few reminders:
- “SSL” and “SSL/TLS” mean implicit TLS, so choose
tls. - “TLS” in a mail app is often shorthand for STARTTLS, so check the port: 587 is a STARTTLS port.
- If a provider lists several ports, start with the one it lists first and fall back to another only if your network blocks it.
Why does “server doesn’t offer STARTTLS” appear?
It means SMTP_SECURITY is starttls but you pointed the relay at an implicit-TLS port, usually 465. Switch to tls on 465, or to 587 with starttls. The relay stops before sending your password rather than falling back to plain text, so this error is a safety feature, not a fault.
Does the port affect deliverability?
No. Port and TLS mode only affect how your login and message reach your provider. Whether the recipient trusts the message depends on your SPF, DKIM and DMARC and your sender reputation. If your login works but mail lands in spam, see custom domain emails going to spam.
What to do next
Look up your provider in the SMTP presets, copy the host, port and security, and test with a real send. If you deploy the Send As relay, our relay docs list every setting, and the setup guide shows where they go.
Frequently asked questions
What is the difference between SMTP port 465 and 587?
Port 465 uses implicit TLS: the connection is encrypted from the first byte. Port 587 starts unencrypted and upgrades with STARTTLS before you log in. Both are secure when configured correctly. Use whichever your provider documents.
Should I use port 465 or 587?
Use the one your provider documents. If both are offered, 465 with SSL/TLS or 587 with STARTTLS are both fine. The key is matching the security mode to the port, otherwise the connection fails or the login is refused.
Why doesn't port 25 work on Cloudflare Workers?
Cloudflare Workers cannot use port 25 for outbound connections, so a Worker-based relay cannot send through it. Use 465, 587, 2465 or 2525 instead, whichever your SMTP provider supports.
What does SMTP error 535 mean?
535 means authentication failed. The most common cause is using your normal account password instead of an app password or SMTP key. Also check the username, which is often the full email address, and that the account allows SMTP.
Keep reading
What Is an SMTP Relay? A Plain-English Explanation
What is an SMTP relay? Plain-English guide: how it works, why browsers cannot speak SMTP, relay vs API, and why your own relay keeps credentials private.
4 min read
Self-Host an SMTP Relay on Cloudflare Workers (Open Source)
A free, open-source SMTP relay on Cloudflare Workers: what the Send As relay does, the one-click deploy, the secrets it needs, ports and what it never stores.
4 min read
Reply From cPanel or GoDaddy Email in Gmail After 2027
Reply from your cPanel or GoDaddy email in Gmail after January 2027: what stops, what keeps working, and your options in order, with SMTP settings to use.
4 min read