Simple SMTP dialogue
Client | Server |
---|---|
Initiates a TCP connection to server. | Presents an SMTP banner - that is, a greeting that starts with the code 220 to indicate that it is ready to speak SMTP (or usually ESMTP, a superset of SMTP): 220 your.f.q.d.n ESTMP… |
Introduces itself by way of an Hello command, either HELO (now obsolete) or EHLO, followed by its own Fully Qualified Domain Name: EHLO peers.f.q.d.n | Accepts this greeting with a 250 response. If the client used the extended version of the Hello command (EHLO), your server knows that it is capable of handling multi-line responses, and so will normally send back several lines indicating the capabilities offered by your server: 250-your.f.q.d.n Hello … 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-STARTTLS 250-AUTH 250 HELP If the PIPELINING capability is included in this response, the client can from this point forward issue several commands at once, without waiting for the response to each one. |
Starts a new mail transaction by specifying the Envelope Sender: MAIL FROM:<sender@address> | Issues a 250 response to indicate that the sender is accepted. |
Lists the Envelope Recipients of the message, one at a time, using the command: RCPT TO:<receiver@address> | Issues a response to each command (2xx, 4xx, or 5xx, depending on whether delivery to this recipient was accepted, subject to a temporary failure, or rejected). |
Issues a DATA command to indicate that it is ready to send the message. | Responds 354 to indicate that the command has been provisionally accepted. |
Transmits the message, starting with RFC 2822 compliant header lines (such as: From:, To:, Subject:, Date:, Message-ID:). The header and the body are separated by an empty line. To indicate the end of the message, the client sends a single period (“.”) on a separate line. | Replies 250 to indicate that the message has been accepted. |
If there are more messages to be delivered, issues the next MAIL FROM: command. Otherwise, it says QUIT, or in rare cases, simply disconnects. | Disconnects. |