Guide · SMTP and headers

STARTTLS vs. implicit TLS: which mode belongs on ports 587 and 465?

Mail submission with STARTTLS usually runs on port 587: the client first exchanges SMTP greetings, then asks the server to switch the same connection to TLS. With implicit TLS, usually on port 465, the TLS handshake starts as soon as the connection opens. Both protect submission well when the client validates the server's certificate and refuses to submit anything until TLS has succeeded. Use the host, port and mode your sending provider documents, not the setting whose name sounds strongest.

Reading time
6 min

Two ways to an encrypted SMTP session

On port 587 the server sends its greeting and the client sends EHLO. The server lists STARTTLS among its capabilities, the client sends STARTTLS, the server answers 220 Ready to start TLS, and the handshake begins (RFC 3207, section 4). After it, both sides must discard what they learned before TLS, and the client should send EHLO again as its first command (section 4.2). The capability list after the handshake can differ from the one before it.

On port 465 (the "submissions" service), the TLS handshake begins immediately when the TCP connection is established (RFC 8314, section 3.3). There is no plain-text greeting and no STARTTLS command. The SMTP greeting, EHLO, authentication and the message all travel inside TLS.

Two simplified timelines (not traces from a real provider):

587, STARTTLS required:
connect → greeting → EHLO → STARTTLS offered → STARTTLS → 220 → TLS handshake and certificate check
        → new EHLO → authenticate and submit inside TLS

465, implicit TLS:
connect → TLS handshake and certificate check → greeting and EHLO inside TLS → authenticate and submit inside TLS

In neither one does the client send credentials or the message before the encrypted connection is established.

Why a mismatched mode and port fails

SettingEndpoint expectsWhat usually happens
Implicit TLSSTARTTLS (port 587)The client sends the start of a TLS handshake to a server waiting for SMTP commands: a handshake or protocol error.
STARTTLSImplicit TLS (port 465)The client waits for an SMTP greeting while the server waits for a handshake: a timeout, an early disconnect or a greeting error.

The exact message depends on the client and the server, so do not diagnose a specific error string from the port alone. A timeout here does not mean the password is wrong: authentication may never have started.

A working TCP connection proves only that the client reached a listening port. It does not show which mode the listener speaks or that the host name matches the certificate. Write down the exact host, port and security mode and compare all three with the provider's current instructions. Do not swap ports and modes at random, turn off certificate validation, or send credentials in plain text to make an error go away. On a server you run, check the listener's configuration and its logs to see where negotiation stopped.

Is port 465 more secure than 587?

RFC 8314 (section 3.3) says there is no significant difference between the security of STARTTLS on port 587 and implicit TLS on port 465 if the implementations are correct and both client and server require successful TLS before submission. It still prefers implicit TLS (sections 1 and 3), while asking clients and servers to implement both during the transition (section 3.3) and mail providers to offer implicit TLS (section 4).

What changes the answer is fallback. STARTTLS starts in plain text, and RFC 3207 (section 6) warns that an attacker in the path can delete the 250 STARTTLS line, so the client never tries TLS. That is why the RFC requires that clients and servers can be configured to insist on TLS before mail is transferred. A client that carries on without encryption when STARTTLS is missing or fails gives no protection against that attack.

Validate the certificate, and fail closed

Encryption without certificate validation does not stop someone in the middle. RFC 8314 sets these rules for mail clients:

So enable certificate and host-name checking, require TLS, and allow no plain-text fallback. Labels in mail client settings vary, so check what a setting does, not what it is called. If required TLS cannot be established, fix the configuration or contact the provider with a log that has credentials and addresses removed.

Submission is not relay between servers

Submission is the connection from your application or mail client to the provider that accepts its outgoing mail. Relay is between mail servers, on port 25. RFC 8314 (section 1) does not cover relay. Choosing port 465 for your application does not decide how later hops are protected, and it does not make a recipient's MX server a submission server. RFC 3207 (section 4) also says a publicly referenced server on port 25 must not require STARTTLS to deliver mail locally.

Between servers, MTA-STS lets a recipient domain publish which MX hosts may receive its mail and a mode. In "enforce" mode, sending servers must not deliver to a host that fails MX matching or certificate validation or does not support STARTTLS (RFC 8461, section 5). That is separate from how your application submits to its own provider (MTA-STS and TLS reporting).

A checklist for a failed setup

  1. Confirm the provider's exact submission host and which mode it uses on which port.
  2. Find the earliest stage that failed in a log with credentials removed: connect, greeting, TLS negotiation, certificate validation or authentication.
  3. For STARTTLS, check that the client reaches the upgrade and then sends a new EHLO. For implicit TLS, check that TLS starts before any SMTP.
  4. If authentication fails after TLS succeeds, look at the account and its settings. A client can complete TLS while the provider still rejects its credentials or the sender address it uses; that is not a handshake failure.

Questions

Which port should I use, 587 or 465?

The one your provider documents, with the mode it names. Both are equally secure when TLS is required and the certificate is validated (RFC 8314, section 3.3).

Why does my client time out on port 465?

A common cause is a client set to STARTTLS: it waits for a plain-text greeting while the server waits for a TLS handshake. Set the mode to implicit TLS, or use the port the provider assigns to STARTTLS.

Is STARTTLS insecure?

Not when TLS is required and the certificate is validated. It is weak when the client continues without TLS, because an attacker can remove the STARTTLS offer (RFC 3207, section 6), or when it accepts a certificate it cannot validate (RFC 8314, section 5).

Try it

See which mail servers a domain publishes with the MX lookup, or check an address with the free email checker.

Sources

How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.

Get up to 500 free credits. No card needed.

New accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service). Try it on your own list before you buy.

Updated · Maintained by: Email Validation LLC