530 5.7.0 Must issue a STARTTLS command first (TLS required before AUTH or sending)

The server refuses AUTH or mail until the connection is upgraded with STARTTLS.

Exact message you may see 530 5.7.0 Must issue a STARTTLS command first530 Must issue a STARTTLS command first530 5.7.0 Must issue a STARTTLS command first.Must issue a STARTTLS command first gsmtp530 5.7.11 Encryption required for requested authentication mechanism
Seen on: SMTP Gmail Email

Meaning

Use port 587 with STARTTLS enabled in the client (secure: false + requireTLS in Nodemailer, starttls() in Python, "STARTTLS/TLS" in mail clients) or implicit TLS on port 465. Port 25 submission without TLS is refused by many providers.

Common causes

  • STARTTLS not enabled in the client
  • Port 587 with encryption "none"
  • Using port 25 without TLS
  • Library skipping STARTTLS
  • Misconfigured proxy removing STARTTLS

⚡ Quick fix

  1. Enable STARTTLS on 587 or use SSL/TLS on 465
  2. Set the encryption option in the app
  3. Test with openssl s_client -starttls smtp

Detailed fix by platform

Python

  1. python
    s = smtplib.SMTP("smtp.example.com", 587)
    s.ehlo(); s.starttls(); s.ehlo(); s.login(user, pw)

How to diagnose

  1. STARTTLS — Enabled?
  2. Port — 587/465?
  3. Proxy — Strips it?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

503 — 503 5.5.1 Bad sequence of commands / Error: send HELO/EHLO first (or need MAIL command) (Email / SMTP)503504 — 504 5.5.4 Unrecognized authentication type (AUTH mechanism not supported) (Email / SMTP)504530 5.7.0 Authentication Required — SMTP: 530 5.7.0 Must issue a STARTTLS command first / 530 5.7.1 Authentication required (Email / SMTP)530 5.7.0 Authenticat…AUTH mechanisms — SMTP AUTH fails: mechanism not supported (PLAIN/LOGIN vs CRAM-MD5/NTLM/XOAUTH2) (Email / SMTP)AUTH mechanismsbad record mac — SSL error: bad record mac (decryption failed or corrupted TLS record) (SSL / TLS)bad record maccert mismatch — SMTP TLS certificate verification failed: hostname mismatch / unable to get local issuer (mail client or library) (Email / SMTP)cert mismatchcurl 56 — curl: (56) OpenSSL SSL_read: Connection reset by peer, errno 104 (TLS connection dropped mid-transfer) (SSL / TLS)curl 56disabledAlgorithms — Java: SSLHandshakeException — TLSv1/TLSv1.1 or algorithm disabled by jdk.tls.disabledAlgorithms (SSL / TLS)disabledAlgorithms530

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.