WRONG_VERSION_NUMBER: SSL wrong version number

AnySMTPIMAPPOP

The error usually looks like this:

ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number

What it means

Your app tried to start an encrypted (SSL/TLS) connection, but the server was expecting a plain connection that is upgraded later with STARTTLS – or the other way round.

Common causes

  • Using SSL/TLS on a STARTTLS port – for example, implicit TLS on port 587 or 143.
  • In code: using SMTP_SSL with port 587 (use SMTP and starttls()), or SMTP with port 465 (use SMTP_SSL).

How to fix it

  1. Match the encryption method to the port: SSL/TLS for 465, 993 and 995; STARTTLS for 587, 143 and 110.
  2. Check the server with our email server checker to see which method each port uses.

Tools to help diagnose it

A free tool provided by Auth-Email

Auth-Email makes your Gmail, Outlook, or other OAuth 2.0 email account available to any IMAP, POP3, or SMTP email client — no app passwords or special configuration needed.

← Look up another email error