Skip to main content

SMTP

Simple Mail Transfer Protocol for email transmission:

Message Format

FieldDescriptionExample Value
CommandSMTP commandEHLO, MAIL, RCPT, DATA, QUIT
ParametersCommand argumentsFROM:<sender@domain.com>, TO:<recipient@domain.com>
Response Code3-digit status code250, 354, 550
Response TextHuman-readable messageOK, Start mail input, Mailbox unavailable
TerminatorCRLF sequence\r\n

Commands

CommandPurpose
HELOIdentify the client, original SMTP
EHLOIdentify the client and request the capability list
MAILBegin a transaction and declare the sender
RCPTAdd a recipient
DATABegin the message content
BDATSend content in sized chunks, as an alternative to DATA
RSETAbandon the current transaction
NOOPNo operation
VRFYVerify an address. Answered 252, which neither confirms nor denies
AUTHAuthenticate
STARTTLSUpgrade the connection to TLS
QUITClose the connection

SEND, SOML, SAML, EXPN, HELP and TURN are answered 502.

The capabilities advertised in response to EHLO are PIPELINING, 8BITMIME, ENHANCEDSTATUSCODES, CHUNKING and SIZE. STARTTLS is advertised only on a connection that is not already encrypted, and AUTH PLAIN only when a username is configured. PLAIN is the only authentication mechanism offered.

Response Codes

CodeCategoryDescription
2xxSuccessCommand completed successfully
3xxIntermediateCommand accepted, more input needed
4xxTransient ErrorTemporary failure, retry possible
5xxPermanent ErrorCommand failed, do not retry

RFC 5321 also defines a 1xx class, which SMTP itself does not use.