SMTP Commands

SMTP commands define the mail transfer or the mail system function requested by the user. The commands are character strings terminated by the carriage return and line feed characters (CR/LF). The SMTP command codes are alphabetic characters. These characters are separated by a space if parameters follow the command or a CR/LF if there are no parameters.

Table 1 describes the SMTP commands that are helpful when interpreting SMTP trace output.

Table 1. SMTP Commands
Name Command Description
DATA DATA The receiver treats the lines following the DATA command as mail data from the sender. This command causes the mail data that is transferred to be appended to the mail data buffer. The mail data can 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 CR/LF CR/LF.
EXTENDED HELLO EHLO This command identifies the SMTP client to the SMTP server and asks the server to send a reply stating which SMTP Service Extensions the server supports. The argument field contains the host name of the client.
EXPAND EXPN This command asks the receiver to confirm that the argument identifies a mailing list and, if so, to return the membership of that list. The full name of the users, if known, and the fully specified mailboxes are returned in a multiline reply.
HELLO HELO This command identifies the sender-SMTP to the receiver-SMTP. The argument field contains the host name of the sender-SMTP.
HELP HELP This command causes the receiver to send information to the sender of the HELP command. The command returns specific information about any command listed as a HELP argument.
MAIL MAIL This command initiates a mail transaction for mail data that is delivered to one or more mailboxes. The required argument field contains a reverse path. If the EHLO command was specified, the optional SIZE field may be used to indicate the size of the mail in bytes, and the optional BODY field may be used to specify whether a 7-bit message or an 8-bit MIME message is being sent.
NOOP NOOP This command requests an OK reply from the receiver. It does not affect any parameters or previously entered commands.
QUIT QUIT This command requests an OK reply from the receiver, and then it closes the transmission channel.
RECIPIENT RCPT This command identifies an individual recipient of the mail data; multiple recipients are specified by multiple RCPT commands.
RESET RSET This command aborts the current mail transaction. Any stored sender, recipient, or mail data is discarded, and all buffers and state tables are cleared. The receiver sends an OK reply.
STARTTLS STARTTLS This command causes the SMTP server to negotiate the use of a secure connection with the SMTP client that issued the command. If the SMTP server is configured for Secure SSL (using the TLS and TLSLABEL configuration statements), and if the negotiation between the client and server succeeds, all subsequent data will be encrypted and flow over a secure connection.
VERIFY VRFY This command asks the receiver to confirm that the argument identifies a user. If it is a user name, the full name of the user, if known, and the fully specified mailbox are returned.
Figure 1 shows the SMTP reply codes. The information shown in this figure is from RFC 821, and RFC 1869.
Figure 1. SMTP Reply Codes. From RFC 821, and RFC 1869
          RFC's 821 and 1869
                                                     Simple Mail Transfer Protocol


                4.2.1.  REPLY CODES BY FUNCTION GROUPS

                   500 Syntax error, command unrecognized
                      {This may include errors such as command line too long}
                   501 Syntax error in parameters or arguments
                   502 Command not implemented
                   503 Bad sequence of commands
                   504 Command parameter not implemented

                   211 System status, or system help reply
                   214 Help message
                      {Information on how to use the receiver or the meaning of a
                      particular non-standard command; this reply is useful only
                      to the human user}

                   220 <domain> Service ready
                   221 <domain> Service closing transmission channel
                   421 <domain> Service not available,
                       closing transmission channel
                      {This may be a reply to any command if the service knows it
                      must shut down}

                   250 Requested mail action okay, completed
                   251 User not local; will forward to <forward-path>
                   450 Requested mail action not taken: mailbox unavailable
                      {E.g., mailbox busy}
                   550 Requested action not taken: mailbox unavailable
                      {E.g., mailbox not found, no access}
                   451 Requested action aborted: error in processing
                   551 User not local; please try <forward-path>
                   452 Requested action not taken: insufficient system storage
                   552 Requested mail action aborted: exceeded storage allocation
                   553 Requested action not taken: mailbox name not allowed
                      {E.g., mailbox syntax incorrect}
                   354 Start mail input; end with <CRLF>.<CRLF>
                   554 Transaction failed
                   555  Requested action not taken:
                        parameters associated with a MAIL FROM
                        or RCPT TO command are not recgnized


          Postel                                                         {Page 35}