STARTTLS is the SMTP command that turns an unencrypted connection into an encrypted one. Most “STARTTLS errors” mean one of three things: the server requires it and you did not send it, the server cannot start TLS right now, or your client and the port expect different kinds of encryption. Each has a clear fix.
The error message
RFC 3207, which defines STARTTLS, gives these replies:
530 Must issue a STARTTLS command first
454 TLS not available due to temporary reason
501 Syntax error (no parameters allowed)
Real servers add enhanced codes. Gmail’s SMTP error reference lists 530 5.7.0 Must issue a STARTTLS command first. and 421 4.7.0 TLS required for RCPT domain, closing connection. For bulk senders, Gmail also rate limits or blocks mail not sent over TLS with 421 4.7.29 and 550 5.7.29.
What it means
An SMTP session starts in plain text. If the server lists STARTTLS in its reply to EHLO, the client can send STARTTLS, the server answers 220, and both sides run a TLS handshake. After that the client should send EHLO again, as the RFC says, then log in and send mail over the encrypted channel.
| Method | Port | How encryption starts |
|---|---|---|
| STARTTLS | 587 (and 25 between servers) | Plain text, then STARTTLS, then TLS. |
| Implicit TLS (“SSL/TLS”) | 465 | TLS handshake before any SMTP. |
Servers that require encryption reject AUTH or MAIL FROM until STARTTLS has run, which is what 530 means.
Why it happens
- Encryption is off in your client, so it tries to log in on plain text.
- The client uses implicit TLS on 587, or STARTTLS on 465. The first gives a wrong version number error, the second usually a timeout.
- An old TLS stack. Devices and old runtimes that only support outdated TLS versions fail the handshake.
- The recipient domain requires TLS (Gmail’s “TLS required for RCPT domain”) and your outbound server sends in plain text.
- The server’s TLS is temporarily broken, such as an expired or missing certificate, giving 454.
- A network device strips STARTTLS from the server’s EHLO reply, so the client never sees the option.
- Microsoft 365: TLS is required to authenticate, and a failed TLS start shows up as 5.7.57.
How to fix it
- Pick port and mode together: 587 with STARTTLS, or 465 with implicit TLS.
- Set your client correctly. Nodemailer:
port: 587, secure: false(it upgrades with STARTTLS automatically). Python:smtplib.SMTP(host, 587)thenstarttls(). PHPMailer:SMTPSecure = PHPMailer::ENCRYPTION_STARTTLSwith port 587. In .NET’sSmtpClient,EnableSsl = trueuses STARTTLS on 587. - Test the server to see if it offers STARTTLS and which certificate it presents:
openssl s_client -starttls smtp -connect smtp.example.com:587 -crlf -quiet - Update old runtimes or firmware so they support TLS 1.2 or later.
- On your own mail server, enable outbound STARTTLS. In Postfix,
smtp_tls_security_level = mayturns on opportunistic TLS for delivery. - For 454, the problem is on the server: renew its certificate or fix its TLS configuration. As a sender, wait and retry.
- Look for interference if STARTTLS is missing from EHLO only on one network: try another network or port 465.
More detail in SMTP ports and SMTP requires a secure connection.
Which server sent it
| Provider | STARTTLS-related replies |
|---|---|
| Gmail | 530 5.7.0 Must issue a STARTTLS command first; 421 4.7.0 TLS required for RCPT domain; 421 4.7.29 / 550 5.7.29 for bulk mail without TLS. |
| Microsoft 365 | TLS required before SMTP AUTH on smtp.office365.com; failures appear as 5.7.57. |
| Yahoo | Not listed by code on its error page. |
| Generic servers | RFC 3207’s 530, 454 and 501 replies. |
Is it temporary?
530 and 501 are permanent for that session: fix the client and connect again. 454 is temporary, and a mail server retries. Gmail’s 421 TLS replies are temporary deferrals, while 550 5.7.29 is a permanent block for bulk senders without TLS.
How Mailcandor handles it
Mailcandor’s SMTP relay at smtp.mailcandor.com supports port 587 with STARTTLS and port 465 with TLS, username mailcandor and an API key as the password. The email API always uses HTTPS, so there is no STARTTLS to configure. Delivery bounces are explained in plain English by the deliverability coach, and hard bounces are suppressed automatically. Decode codes with the free bounce code lookup, see SPF, DKIM and DMARC setup, or browse all error codes. More free checks are on the tools page.