5.5.2 bounce: SMTP syntax error
5.5.2Syntax errorPermanent: retrying will not help
502 5.5.2 Error: command not recognized
What it means
RFC 3463 names X.5.2 “syntax error”: a command was received that the server could not parse. Postfix answers 502 5.5.2 when a line matches no SMTP verb it knows, and other servers use 500 5.5.2 for a garbled line.
Compared with 5.5.1, the server is not complaining about order but about form. It may have received junk, a truncated line or a verb with a typo. Compared with 5.5.4, the problem is the line as a whole rather than one parameter.
Syntax errors are permanent by nature, so you rarely see a 4.5.2. When they appear in volume from one client they often mean something is not talking SMTP at all, for instance an HTTP request or a TLS handshake aimed at a plain-text port.
Likely causes
- Implicit TLS (port 465 style) traffic sent to a port that expects plain SMTP, so the server reads binary handshake data as commands.
- A script that sends LF instead of CRLF line endings, or that inserts extra spaces or quotes around addresses.
- A misspelled verb (for example EHL0 with a zero) in hand-written test code.
- A security scanner or web client probing your mail port, which shows up as 5.5.2 in your own server logs rather than in a bounce.
How to fix it
- Match the TLS mode to the port: plain SMTP with optional STARTTLS on 25 and 587, implicit TLS on 465.
- Capture the raw session (Postfix `debug_peer_list`, or a packet capture) and look at the exact bytes of the rejected line.
- Terminate every command with CRLF and follow RFC 5321 command forms exactly, for example `MAIL FROM:<user@example.com>` with no space after the colon.
- If the errors are in your own logs and come from unknown IPs, treat them as scanning noise; rate limits or fail2ban are more useful than a code change.
Checks that apply
- SMTP Diagnostics Runs a clean, standards-compliant session against the server so you can compare its responses with what your client receives.
- TCP Port Test Tells you which mail ports are open, which helps you pick the right TLS mode for the port you are using.
FAQ
- Does a 5.5.2 mean my email content is bad?
- No. It concerns the SMTP commands, not the message body. Content problems use X.6 codes or policy codes such as 5.7.1.
- Why does my Outlook or phone client see 5.5.2?
- Usually the account is set to the wrong encryption type for the port. Pick STARTTLS for 587 or SSL/TLS for 465 and try again.