SMTP: [SSL: WRONG_VERSION_NUMBER] wrong version number — SMTP over SSL on a STARTTLS port
Your client tried to start TLS immediately on a port where the server speaks plain SMTP first (or the reverse), so the handshake looks garbled.
[SSL: WRONG_VERSION_NUMBER] wrong version numberssl.SSLError: [SSL: WRONG_VERSION_NUMBER]error:1408F10B:SSL routines:ssl3_get_record:wrong version numberSSL routines wrong version number SMTPpacket length too long smtp Meaning
Port 465 uses implicit TLS (SSL from the first byte); port 587 starts plain and upgrades with STARTTLS. Mixing them gives wrong version number, packet length too long or unexpected EOF. Match the connection mode to the port.
Common causes
- SSL/TLS enabled on port 587 (should be STARTTLS)
- STARTTLS used on port 465 (should be implicit SSL)
- Port 25 with TLS wrapper mode
- A proxy or antivirus intercepting SMTP
- Server not offering TLS at all
⚡ Quick fix
- Port 587 → STARTTLS (
secure: falsein Nodemailer,SMTP()+starttls()in Python) - Port 465 → implicit TLS (
SMTP_SSL,secure: true) - Test with openssl first
Detailed fix by platform
Linux
openssl s_client -starttls smtp -connect smtp.example.com:587(STARTTLS) vsopenssl s_client -connect smtp.example.com:465(implicit)
Code examples
Correct per port
import smtplib
# 587: plain connect, then upgrade
s = smtplib.SMTP("smtp.example.com", 587); s.starttls()
# 465: TLS from the start
s2 = smtplib.SMTP_SSL("smtp.example.com", 465)How to diagnose
- Port — 465 or 587?
- Mode — SSL or STARTTLS?
- Proxy — AV or proxy in between?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 421 4.7.0 Try again later (rate limited) SMTP: 421 4.7.0 Our system has detected an unusual rate of unsolicited mail originating from your IP address. Mail sent from your IP address has been temporarily rate limited
- 450 4.7.1 Greylisted, please try again later SMTP: 450 4.7.1 <user@example.com>: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/example.com.html
- 451 4.3.0 Local error in processing SMTP: 451 4.3.0 Error: queue file write error / 451 Requested action aborted: local error in processing
Most viewed in Email / SMTP
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 4 Nov 2026