SMTP

SMTP 221 Closing Connection vs 334 Server Challenge

SMTP 221 (Closing Connection) is a 2xx Positive Completion response, while 334 (Server Challenge) is a 3xx Positive Intermediate response. 221 indicates that the server is closing the transmission channel. This is the normal response to the QUIT command, indicating a graceful end to the SMTP session. In contrast, 334 means that the server is issuing an authentication challenge as part of the SASL authentication exchange. The response contains a Base64-encoded challenge that the client must decode and respond to.

Описание

The server is closing the transmission channel. This is the normal response to the QUIT command, indicating a graceful end to the SMTP session.

Когда вы это видите

After sending the QUIT command at the end of a mail session. The server acknowledges the disconnect and the TCP connection will be closed.

Как исправить

No fix needed — this is the expected response when ending an SMTP session. If you see this unexpectedly, the server may be shutting down or timing out idle connections.

Описание

The server is issuing an authentication challenge as part of the SASL authentication exchange. The response contains a Base64-encoded challenge that the client must decode and respond to.

Когда вы это видите

During the AUTH command handshake. The server is prompting you for your username or password (Base64-encoded) as part of the multi-step authentication process.

Как исправить

Respond with the appropriate Base64-encoded credentials. If authentication keeps failing after responding, verify your credentials and ensure you are using the correct SASL mechanism.

Ключевые различия

1.

221 is a 2xx Positive Completion response, while 334 is a 3xx Positive Intermediate response.

2.

SMTP 221: The server is closing the transmission channel. This is the normal response to the QUIT command, indicating a graceful end to the SMTP session.

3.

SMTP 334: The server is issuing an authentication challenge as part of the SASL authentication exchange. The response contains a Base64-encoded challenge that the client must decode and respond to.

4.

You encounter 221 when after sending the QUIT command at the end of a mail session. The server acknowledges the disconnect and the TCP connection will be closed.

5.

You encounter 334 when during the AUTH command handshake. The server is prompting you for your username or password (Base64-encoded) as part of the multi-step authentication process.

Когда что использовать

For 221 (Closing Connection): No fix needed — this is the expected response when ending an SMTP session. If you see this unexpectedly, the server may be shutting down or timing out idle connections. For 334 (Server Challenge): Respond with the appropriate Base64-encoded credentials. If authentication keeps failing after responding, verify your credentials and ensure you are using the correct SASL mechanism.

Узнать больше