Putting It All Together


Now that you've seen the simple command set that is used by SMTP, and the simple response code mechanism, you can put it all together and see an example of how a particular mail transaction might occur:

  1. First, the Sender-SMTP sends a HELO or an EHLO command to the SMTP server.

  2. The MAIL command is used, with the reverse-path information. At this state, the SMTP server knows who wants to send the mail message and a return path to send back error messages should anything go awry. The server clears the necessary buffers and sends the "250 OK" message back to the sender.

  3. The RCPT command is issued by the client giving a forward-path of exactly one recipient of the mail message. If more than one recipient is the target of the message, multiple RCPT commands must be used. The "250 OK" response is sent if the server thinks it can get the message delivered. If not, the SMTP server returns a code of 550, which is a failure code.

  4. The DATA command is sent to the server. The server will return an intermediate reply code, 354, indicating that the remaining lines it receives from the sender will be interpreted as part of the email message.

  5. The client sends each line of text, and the server responds with "250 OK" for each line received. When the client is finished sending the message, a line with a single period character (".") is sent (with the appropriate <CRLF> that ends every line of text in SMTP).

  6. After receiving a final OK from the server, the client issues the QUIT command to terminate the session.

In these steps, information typically found in an email messagethe subject, date, and so onare included as part of the email message data that is transmitted following the DATA command. Also, this is a simple message exchange. It can get more complicated. For example, the server can return a reply code of "251 - User not local; will forward to..." followed by the forward-path information. This happens when the Receiver-SMTP knows the correct host on which a destination user's mailbox is located, but it differs from the one sent by the client. Another message of a similar type leaves the process of sending mail to another destination up to the client. This message, "551 - User not local..." supplies the client with the forward-path that the client can use to deliver the message. In this case, however, the server does not forward the message but lets the client take further action.




Upgrading and Repairing Networks
Upgrading and Repairing Networks (5th Edition)
ISBN: 078973530X
EAN: 2147483647
Year: 2006
Pages: 411

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net