SMTP error 500
Syntax error — command unrecognized.
Updated Jul 1, 2026
SMTP 500 means "syntax error, command unrecognized": a permanent failure where the receiving server could not parse the command your client sent. It is almost never the message content. Usually the client spoke the wrong protocol on the wrong port (plaintext on an implicit-TLS port, or TLS into a plaintext port), sent a malformed or over-long command, or a proxy mangled the session. Match the port to the encryption mode.
Check your mail client or relay config and any security software sitting between you and the server.
What it means
500 is defined in RFC 5321 as "Syntax error, command unrecognized (this may include errors such as command line too long)." It is a permanent failure: the leading 5 means the command was not accepted, and the second digit 0 means the problem is with the SMTP protocol itself. Because it is permanent, resending the exact same command will not help; something about how the command is sent has to change. In enhanced-code terms this maps to 5.5.2 (syntax error).
Common causes
Sending plaintext commands into an implicit-TLS socket (port 465), or attempting a TLS handshake against a plaintext or STARTTLS port. The raw TLS bytes read as gibberish commands and the server answers 500. Both 465 (implicit TLS) and 587 (STARTTLS) are valid; the port and encryption mode must match.
Bad line endings (a bare newline instead of CRLF), an unrecognized verb, or raw 8-bit bytes where the server expects ASCII.
RFC 5321 caps a command line at 512 octets including CRLF. An over-long line, such as a huge address list on one line, returns 500.
Antivirus mail shields, SMTP proxies, or firewalls intercepting the port can rewrite or truncate the handshake so the server sees an invalid command. This is the real reason behind old "disable antivirus" advice.
How to fix it
- Match the port to the encryption mode
Use 465 with implicit TLS, or 587 (or 25 for server-to-server) with STARTTLS. Do not start TLS on 465 or send plaintext on 465. In Nodemailer use secure: true for 465 and secure: false for 587; in Python use SMTP_SSL for 465 and starttls() for 587.
- Capture the exact failing command
Enable protocol logging (Nodemailer logger and debug true; Python set_debuglevel(1)) and read which verb drew the 500. The line just before the 500 is the culprit.
- Validate command formatting
Ensure every command ends in CRLF, is ASCII (use SMTPUTF8 or 8BITMIME only if the server advertised it), and stays under 512 octets. If you author SMTP by hand, switch to a maintained library.
- Send EHLO first, fall back to HELO
If the server does not recognize EHLO, the client should fall back to HELO. Good libraries do this automatically.
- Bypass interfering middleware to isolate it
Test from a host without an SMTP-scanning antivirus or proxy, or exempt the mail port, to confirm whether a security appliance is rewriting the session. Re-enable it and add a proper exception afterward.
Common questions
Is 500 a problem with my email content or recipient address?
No. It is a protocol-layer syntax error; the server could not parse the SMTP command itself. Bad addresses surface as 550, 553, or 501. A 500 points at how the client connected or formatted commands.
Should I retry after a 500?
Not without changing something. It is permanent, so resending the exact command fails again. Fix the port, TLS mode, or command formatting first.
Does 500 mean the server does not support a command?
No. That is 502 (command not implemented). 500 means the server could not even recognize what you sent as a known command.