Errors

STARTTLS errors when sending email: what they mean and how to fix them

Short answer

STARTTLS is the SMTP command that upgrades a plain connection to an encrypted one, defined in RFC 3207. Errors come in three kinds: the server requires it ("530 5.7.0 Must issue a STARTTLS command first"), the server cannot do it right now ("454 TLS not available due to temporary reason"), or your client and the port disagree, which shows up as TLS errors like wrong version number. Use port 587 with STARTTLS, or port 465 with TLS from the start.

Last checked 16 November 2026

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

  1. Pick port and mode together: 587 with STARTTLS, or 465 with implicit TLS.
  2. Set your client correctly. Nodemailer: port: 587, secure: false (it upgrades with STARTTLS automatically). Python: smtplib.SMTP(host, 587) then starttls(). PHPMailer: SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS with port 587. In .NET’s SmtpClient, EnableSsl = true uses STARTTLS on 587.
  3. 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
  4. Update old runtimes or firmware so they support TLS 1.2 or later.
  5. On your own mail server, enable outbound STARTTLS. In Postfix, smtp_tls_security_level = may turns on opportunistic TLS for delivery.
  6. For 454, the problem is on the server: renew its certificate or fix its TLS configuration. As a sender, wait and retry.
  7. 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.

Questions

What is STARTTLS?

An SMTP command that tells the server to switch the current plain text connection to TLS. After it, everything including the login is encrypted. RFC 3207 defines it.

What is the difference between STARTTLS and SSL/TLS?

Both end in an encrypted connection. STARTTLS starts in plain text and upgrades, usually on port 587. SSL/TLS, also called implicit TLS, is encrypted from the first byte, usually on port 465.

What does "Must issue a STARTTLS command first" mean?

The server requires encryption before it accepts the next command, usually AUTH or MAIL FROM. Turn on STARTTLS (often labeled TLS) in your client.

Which port does STARTTLS use?

Port 587 for submitting mail from apps and clients, and port 25 between mail servers. Port 465 uses implicit TLS instead.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.