- Protocol Definition
- Simple Mail Transport Protocol
- SMTP RFC 821,
Jonathan B. Postel, August 1982
- SMTP uses TCP port 25.
Protocol Model
- The SMTP design is based on the following model of communication: as
the result of a user mail request, the sender-SMTP establishes a two-way
transmission channel to a receiver-SMTP. The receiver-SMTP may be either the
ultimate destination or an intermediate. SMTP commands are generated by the
sender-SMTP and sent to the receiver-SMTP. SMTP replies are sent from the
receiver-SMTP to the sender-SMTP in response to the commands.
Once the transmission channel is established, the SMTP-sender sends
a MAIL command indicating the sender of the mail. If the SMTP-receiver can
accept mail it responds with an OK reply. The SMTP-sender then sends a RCPT
command identifying a recipient of the mail. If the SMTP-receiver can accept
mail for that recipient it responds with an OK reply; if not, it responds with
a reply rejecting that recipient (but not the whole mail transaction). The
SMTP-sender and SMTP-receiver may negotiate several recipients. When the
recipients have been negotiated the SMTP-sender sends the mail data,
terminating with a special sequence. If the SMTP-receiver successfully
processes the mail data it responds with an OK reply. The dialog is purposely
lock-step, one-at-a-time.
Command Summary
- SMTP commands are character strings terminated by
<CRLF>. The commands consist of a command code followed by an
argument field. Command codes are four alphabetic characters. Upper and lower
case alphabetic characters are to be treated identically.
The command codes themselves are alphabetic characters terminated by
<SP> if parameters follow and <CRLF> otherwise.
| Command |
Syntax |
Error Codes |
|
Description |
| HELLO |
HELO domain |
S: 250 E: 500, 501, 504, 421 |
|
Deliver mail to one or more mailboxes. The argument
field contains a reverse-path. |
| MAIL |
MAIL FROM:reverse-path |
S: 250 F: 552, 451, 452 E: 500, 501,
421 |
|
Deliver mail to one or more mailboxes. The argument
field contains a reverse-path. |
| RECIPIENT |
RCPT TO:forward-path |
S: 250, 251 F: 550, 551, 552, 553, 450, 451,
452 E: 500, 501, 503, 421 |
|
Set a recipient of the mail data; multiple recipients
are specified by multiple uses of this command. |
| DATA |
DATA |
I: 354 -> data -> -> S:
250 -> F: 552, 554, 451, 452 F: 451, 554 E: 500, 501, 503,
421 |
|
The lines following the command is mail data from the
sender. The mail data from this command is be appended to the mail data buffer.
The mail data may contain any of the 128 ASCII character codes.
The mail data is terminated by a line containing only a period,
that is the character sequence "<CRLF>.<CRLF>".
This is the end of mail data indication. |
| SEND |
SEND FROM:reverse-path |
S: 250 F: 552, 451, 452 E: 500, 501, 502,
421 |
|
Deliver mail to one or more terminals. The argument
field contains a reverse-path. |
| SEND OR MAIL |
SOML FROM:reverse-path |
S: 250 F: 552, 451, 452 E: 500, 501, 502,
421 |
|
Deliver mail to one or more terminals or mailboxes. The
argument field contains a reverse-path. |
| SEND AND MAIL |
SAML FROM:reverse-path |
S: 250 F: 552, 451, 452 E: 500, 501, 502,
421 |
|
Deliver mail to one or more terminals or mailboxes. The
argument field contains a reverse-path. |
| RESET |
RSET |
S: 250 E: 500, 501, 504, 421 |
|
Abort the mail transaction. |
| VERIFY |
VRFY string |
S: 250, 251 F: 550, 551, 553 E: 500, 501,
502, 504, 421 |
|
Verify that string identifies a user. If it is
a user name, the full name of the user (if known) and the fully specified
mailbox are returned. |
| EXPAND |
EXPN string |
S: 250 F: 550 E: 500, 501, 502, 504,
421 |
|
Expand the mailing list. The full name of the users (if
known) and the fully specified mailboxes are returned, one to a line, in a
multiline reply. |
| HELP |
HELP[ string] |
S: 211, 214 E: 500, 501, 502, 504,
421 |
|
Provide server information. The command may take an
argument (e.g., any command name) and return more specific information as a
response. . |
| NOOP |
NOOP |
S: 250 E: 500, 421 |
|
The receiver should send an OK reply. |
| QUIT |
QUIT |
S: 221 E: 500 |
|
The receiver sends an OK reply, and then closes the
transmission channel. . |
| TURN |
TURN |
S: 250 F: 502 E: 500, 503 |
|
Reverse the roles of the two programs communicating
over the transmission channel. |
|