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.

詳しく見る