502 5.5.1 is a 5yz permanent failure paired with 5.5.1, which RFC 3463 defines as "command
not implemented". The receiving SMTP server understood the connection but does not support a
specific command the client issued — this happens at the protocol level, before your message
content is ever evaluated.
A real transcript
EHLO yourdomain.com 250-mx.example.com 250-SIZE 35882577 250-8BITMIME 250 STARTTLS STARTTLS 220 2.0.0 Ready to start TLS MAIL FROM:<you@yourdomain.com> 250 2.1.0 Sender OK RCPT TO:<recipient@example.com> 250 2.1.5 Recipient OK VRFY recipient@example.com 502 5.5.1 Command not implemented
In this example VRFY (an old recipient-verification command) is the one rejected — most modern
servers disable it deliberately for privacy and anti-harvesting reasons. The same code shows up for
any command the client sends that the server's EHLO capability list did not advertise.
How different servers report an unsupported command
| Server/provider | Typical wording | Usual trigger |
|---|---|---|
| Gmail / Google Workspace | 502 5.5.1 Unrecognized command | Nonstandard or malformed command verb |
| Microsoft 365 | 502 5.5.1 Invalid command, or sequence of commands | Overlaps with 503-style sequencing issues in practice |
| Generic Exim/Postfix | 502 Command not implemented (base code only, no enhanced status) | Older servers often omit the x.y.z suffix entirely |
The last row matters for anyone parsing logs: not every server sends the enhanced status code at
all, so code that assumes 5.5.1 will always be present after 502 will miss a meaningful share
of real-world replies.
Who is at fault
The sending client or library, in essentially all cases. Something in your SMTP implementation
— a hand-rolled script, an outdated library, or a misconfigured relay — is issuing a command the
destination server does not support, usually because it was never advertised in the EHLO
response in the first place.
Diagnose it yourself
- Capture the full SMTP transcript, including the
EHLOresponse that lists supported
extensions. With openssl s_client -starttls smtp -connect mx.example.com:25 you can step
through the session by hand and see the exact capability list before issuing any command.
- Compare the command set your client sends against the advertised `EHLO` capability list —
grep your client library's source or debug output for the literal command verb it issues right
before the 502.
- Check whether the command is optional or deprecated (
VRFY,EXPN, or a vendor-specific
extension) — RFC 5321 marks several commands as optional, and a compliant server is free to
reply 502 to any of them.
- Reproduce with a minimal manual session — strip your script down to the bare
EHLO,
MAIL FROM, RCPT TO, DATA sequence and confirm that succeeds before reintroducing whichever
extra command triggered the failure.
How to diagnose the problem
Step 1: Review the full error message
The text after 502 5.5.1 sometimes names the offending command directly; read it before assuming
which command failed.
Step 2: Check SMTP command logs
If your sending library has a debug or verbose mode, enable it for one send and capture the exact
command sequence transmitted.
Step 3: Compare client and server SMTP settings
Confirm your client is not hardcoded to assume a capability (such as a specific AUTH mechanism or
pipelining) without checking the server's EHLO response first.
Fixes and workarounds for SMTP Error 502 5.5.1
- Update your email client or library to a current version — this error is common with old,
hand-rolled SMTP code that hardcodes a command sequence instead of negotiating capabilities.
- Remove or make conditional any command not universally supported, falling back gracefully
when a server's EHLO response does not list it.
- Switch to supported alternatives — if your code relies on
VRFYfor address validation, use
actual delivery attempts or a dedicated verification service instead; no modern receiving server
should be expected to support it.
What not to do
- Do not treat this as a deliverability or reputation problem — it has nothing to do with your
domain's sending history or your message content, and "warming up" a mailbox will not fix a
protocol mismatch.
- Do not retry the exact same command against the same server expecting a different result; the
server does not implement it and will not start to, regardless of how many times you ask.
- Do not disable TLS or authentication to work around it — the fix is almost always to stop
sending the unsupported command, not to weaken the connection, and disabling TLS introduces a
real security regression for zero benefit here.
MailPilot's integrations use standard, well-supported SMTP/IMAP flows for the providers it
connects to (SendGrid, Amazon SES, Mailgun, Postmark, and custom SMTP), so this class of
protocol-level error is not something warm-up traffic through MailPilot triggers — it is worth
checking first in any custom sending code you run outside it.
Ready to reach the inbox every time?
Automated email warmup across real peer mailboxes. Live inbox placement monitoring. Free 7-day trial - no credit card required.
Start free trial