221
SMTPINFOCriticalConnectionHIGH confidence
<domain> Service closing transmission channel
What this means
The 221 code is sent by the server to confirm that the connection is being closed. This is a graceful termination of the SMTP session, typically after the client sends a `QUIT` command.
Why it happens
- 1The client sent the `QUIT` command to end the session.
- 2The server is shutting down the connection gracefully for other reasons, such as a timeout.
How to reproduce
A client sends the QUIT command after successfully sending an email.
trigger — this will error
trigger — this will error
QUIT 221 2.0.0 Bye
expected output
221 Service closing channel
Fix
Close the TCP connection immediately after receiving 221
WHEN After sending QUIT
Close the TCP connection immediately after receiving 221
QUIT 221 2.0.0 Bye # TCP connection must now be closed by client
Why this works
221 is the final reply in an SMTP session. Both sides must close the TCP connection. Do not issue further commands after 221.
What not to do
✕ Reuse a connection after receiving 221
The server considers the session closed after 221. Sending further commands will fail or be silently dropped.
Sources
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev