SMTP error 221
Service closing transmission channel.
Updated Jul 1, 2026
SMTP 221 is not an error. It is the normal, successful reply a server sends after QUIT to say it is closing the connection cleanly — "Service closing transmission channel." If your mail still failed, the real cause is an earlier 4xx or 5xx line in the transcript, not the 221.
Normal end-of-session message. Nothing to do.
What it means
Every healthy SMTP session ends in 221. After your client sends QUIT, the server is required to answer with 221 and close the channel. So seeing 221 in a log means the conversation ended gracefully — the server handled everything it was given this session. Many servers prepend the enhanced code 2.0.0 ("success"), giving lines like "221 2.0.0 Bye". Authentication problems, by contrast, show up as 535 or 530 — never as 221, so do not chase credentials on the strength of a 221.
Common causes
Scroll up. A 4xx (temporary) or 5xx (permanent) line before the 221 is the actual error. A 550 rejection followed by 221 just means the server refused the mail, then closed normally.
Some servers drop idle connections or hit a per-session limit and send 221 (or 421 on a forced shutdown) mid-transaction. Treat that as a connection-handling issue — reduce idle time or concurrency and add reconnect logic.
Acceptance is signaled by 250 after DATA, not 221. If success is keyed off 221, that is a bug.
How to fix it
- Read the line before the 221
If it is a 250, that hop accepted your message. If it is a 4xx or 5xx, that line is your real error — look that code up instead.
- Capture the full transcript
The 250 is where acceptance happens; the 221 is just the clean close.
S: 250 2.0.0 OK: queued as 9F2C1 C: QUIT S: 221 2.0.0 Bye - Fix success detection in code
Key delivery success off the 250 after DATA, not the 221.
Common questions
Is 221 an error?
No. It is a positive completion reply ("Service closing transmission channel") sent after QUIT, marking a normal end to the session.
My email failed but I got a 221 — why?
The 221 only means the session closed cleanly. The failure is an earlier 4xx/5xx line in the same transcript — that is where the fix lives.