SMTP code 500 means the server received a command it does not recognize. This happens when the command verb is misspelled, the line exceeds the 512-byte limit (or 998 bytes for extended), the command contains illegal characters, or the client is sending non-SMTP data on an SMTP connection. This is a permanent error for the specific command — the client should not retry the same command but can continue the SMTP session with corrected commands. Code 500 is distinct from 502 (command recognized but not implemented) and 501 (command recognized but parameters are wrong).
The client sent a command with a typo (e.g., 'HLEO' instead of 'HELO') or included garbage characters. SMTP commands are case-insensitive but must be one of the recognized verbs: HELO, EHLO, MAIL, RCPT, DATA, QUIT, RSET, VRFY, EXPN, NOOP.
An HTTP client, SSH client, or other non-SMTP software connected to the SMTP port and sent data that is not a valid SMTP command. The server sees the first line of the non-SMTP protocol and returns 500.
RFC 5321 limits SMTP command lines to 512 characters (including CRLF). Lines exceeding this limit may be treated as unrecognizable by strict servers. This can happen with very long email addresses in MAIL FROM or RCPT TO with excessive parameters.
Enable SMTP debug logging in your mail client or application to see the exact bytes being sent. Look for typos, extra spaces, or invisible characters in the command.
Connect manually and type commands one by one to isolate which command triggers the 500 error. Start with EHLO, then MAIL FROM, RCPT TO, DATA.
telnet mail.example.com 25
After connecting, send EHLO to see the server's supported extensions. Some servers may not support certain commands (VRFY, EXPN) and will return 500 instead of the more correct 502.
If the server requires TLS and you are sending plaintext commands, the server may not recognize them correctly. Use STARTTLS or connect to the implicit TLS port (465).
openssl s_client -connect mail.example.com:587 -starttls smtp
The SMTP command was recognized but the parameters or arguments are malformed or invalid.
The SMTP server recognized the command but has not implemented it or has disabled it.
The SMTP commands were sent in the wrong order. The server requires a specific command sequence.