SMTP

SMTP 221 Closing Connection vs 354 Start Mail Input

SMTP 221 (Closing Connection) is a 2xx Positive Completion response, while 354 (Start Mail Input) 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, 354 means that the server is ready to receive the message body. The client should begin sending the email content (headers and body) and terminate with a single line containing only a period (CRLF.CRLF).

คำอธิบาย

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 ready to receive the message body. The client should begin sending the email content (headers and body) and terminate with a single line containing only a period (CRLF.CRLF).

เมื่อคุณพบเห็น

After sending the DATA command. The server is now waiting for you to type or stream the email message, ending with a dot on its own line.

วิธีแก้ไข

Send your message content followed by a line with just a period (.) to signal the end. If you get an error after this, check that your message does not contain a bare period on a line by itself within the body.

ความแตกต่างหลัก

1.

221 is a 2xx Positive Completion response, while 354 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 354: The server is ready to receive the message body. The client should begin sending the email content (headers and body) and terminate with a single line containing only a period (CRLF.CRLF).

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 354 when after sending the DATA command. The server is now waiting for you to type or stream the email message, ending with a dot on its own line.

ควรใช้อันไหนเมื่อไร

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 354 (Start Mail Input): Send your message content followed by a line with just a period (.) to signal the end. If you get an error after this, check that your message does not contain a bare period on a line by itself within the body.

เรียนรู้เพิ่มเติม