SMTP Command Reference

jeremyheiler edited this page Jan 26, 2012 · 2 revisions

SMTP Command Reference

Commands are sent by the client in order to instruct the server to do something.

The syntax for describing the commands is kept simple. Anything that is between double quotes should be taken literally, except for that is also case-insensitive. Anything inside square brackets is optional. Anything not in double quotes is a keyword defined below.

  • SP: The space character.
  • USER: A username on the target host. Case must be preserved for hosts that have case-sensitive usernames.
  • DOMAIN: A fully-qualified domain name.
  • ADDRESS: An email address defined as USER@DOMAIN
  • PARAMS: Parameters negotiated by an extension.
  • CRLF: The carriage return and line feed characters, i.e. \r\n.

Every thing else should be considered whitespace and ignored.

HELLO

"HELO" SP DOMAIN CRLF

The HELLO command is used to by a client to identify itself with a server. This command should only be used as a fallback for servers that do not support EXTENDED HELLO.

EXTENDED HELLO

"EHLO" SP DOMAIN CRLF

The EXTENDED HELLO command is used by a client to identify itself with a server. This is preferred over HELLO because it allows the client and server to negotiate and use SMTP extensions.

MAIL

"MAIL FROM:<" ADDRESS ">" [SP PARAMS] CRLF 

The MAIL command is used to initiate a transaction in order to send mail. Only one transaction can be in progress at a time.

RECIPIENT

"RCPT TO:<" ADDRESS ">" [SP PARAMS] CRLF

This RECIPIENT command is used to identify the addresses the mail should be sent to. This command needs to be issued for each individual recipient.

DATA

"DATA" CRLF

RESET

"RSET" CRLF

The RESET command instructs the server to cancel the current MAIL transaction if one is in progress.

VERIFY

"VRFY" SP USER CRLF

The VERIFY command instructs the server to determine if the supplied USER is valid.

EXPAND

"EXPN" SP USER CRLF

The EXPAND command instructs the server to determine if the USER is a mailing list, and if it is, to return the members of the list one by one.

HELP

"HELP" [SP COMMAND] CRLF

The HELP command will instruct the server to send helpful information. When supplied with a COMMAND, the server may send specific information about that command.

NOOP

"NOOP" [SP TEXT] CRLF

The NOOP command instructs the server to do nothing except send a reply. The optional TEXT should be ignored.

QUIT

"QUIT" CRLF

The QUIT command instructs the server that the client is disconnecting.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.