The objective of SMTP is to deliver email reliably and efficiently. SMTP addresses a mail request with this basic model:
· A two-way transmission channel is set up between the sender and receiver.
· The sender generates SMTP commands that are sent to the receiver.
· The receiver responds with SMTP replies.
These are common SMTP commands:
Note: Commands are case insensitive (for example mail=MaiL). For an entire list, refer to section 4.1 of RFC 821.
· HELO—Identifies the sender-SMTP to the receiver-SMTP. The receiver-SMTP identifies itself in the OK reply. It must be the the first message in the SMTP exchange if service extensions are unsupported.
· vdtl-5300-7a#telnet 172.18.106.36 25
· Trying 172.18.106.36, 25 ... Open
· 220 testlab-smtp.testlab-t37.com Microsoft ESMTP MAIL Service,
· Version: 5.0.2195.4453 ready at Tue, 5 Mar 2002 12:08:24 -0500
· mail from:<tom@testlab-t37.com>
· 503 5.5.2 Send hello first
·
· EHLO—Used instead of the HELO command to start a session from a client that supports SMTP service extensions. If the server does not support service extensions, the server generates an error response.
· MAIL—Initiates a mail transaction. The argument field contains the address that the email is from (such as the sender's mailbox).
· RCPT—Identifies the recipient of the email. Multiple recipients are specified by multiple commands (such as the To: field).
· DATA—Mail data (such as the body of the email). A period on a line by itself (character sequence <CRLF>.<CRLF>) marks the end of the data.
· SEND—Initiates the delivery of the mail message.
· QUIT—Closes the SMTP session. An OK reply is necessary before the channel is closed.
Every SMTP command must generate exactly one reply. SMTP replies consist of a three-digit number followed by text. The numbers indicate what state to enter next, and the text is the decoded reply and meant for the user to debug. For a complete list of SMTP reply codes, see the SMTP Reply Codes section of this document. Enhanced system status codes to be used with Delivery Status Notifications (DSN) have been added with RFC 1893. For certain replies, these enhanced codes give more detailed information about the transaction. For more information on this, refer to the "SMTP Details" section in RFC 821.
In this example, simply Telnet to the SMTP server and issue commands. No email clients are used to send the email. Familiarity with these commands and message flow is important when you debug S&F faxing on the gateways. This knowledge helps to eliminate pieces of the puzzle.
· Sender commands are preceded with S:.
· Receiver replies are preceded with R:.
· Reply codes are in italics.
· SMTP commands are in quotes.
· System status codes are in bold.
vdtl-5300-7a#telnet 172.18.106.36 25
Trying 172.18.106.36, 25 ... OpenR: 220 testlab-smtp.testlab-t37.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.4453 ready at Tue, 5 Mar 2002 12:10:01 -0500
S: "helo" testlab-t37.com
R: 250 testlab-smtp.testlab-t37.com Hello [15.80.7.11]
S: "mail" from:<tom@testlab-t37.com>
R: 250 2.1.0 tom@testlab-t37.com....Sender OK
S: "rcpt" to:<john@testlab-t37.com>
R: 250 2.1.5 john@testlab-t37.com
S: "data"
R: 354 Start mail input; end with <CRLF>.<CRLF>
Subject: This is a test email sent from telnetting to the SMTP server on port 25From: Tom Jackson
This is an email sent from Tom to John on the testlab-smtp server by Telnetting to port 25 on the server, where only SMTP commands are used from the command line:
R: 250 2.6.0 <testlab-smtpeYrQz0ek6He00000002@testlab-smtp.testlab-t37.com> Queued mail for delivery
S: "quit"
R: 221 2.0.0 testlab-smtp.testlab-t37.com Service closing transmission channel
[Connection to 172.18.106.36 closed by foreign host]vdtl-5300-7a#