SMTP
Simple Mail Transfer Protocol for email transmission:
Message Format
| Field | Description | Example Value |
|---|---|---|
| Command | SMTP command | EHLO, MAIL, RCPT, DATA, QUIT |
| Parameters | Command arguments | FROM:<sender@domain.com>, TO:<recipient@domain.com> |
| Response Code | 3-digit status code | 250, 354, 550 |
| Response Text | Human-readable message | OK, Start mail input, Mailbox unavailable |
| Terminator | CRLF sequence | \r\n |
Commands
| Command | Purpose |
|---|---|
HELO | Identify the client, original SMTP |
EHLO | Identify the client and request the capability list |
MAIL | Begin a transaction and declare the sender |
RCPT | Add a recipient |
DATA | Begin the message content |
BDAT | Send content in sized chunks, as an alternative to DATA |
RSET | Abandon the current transaction |
NOOP | No operation |
VRFY | Verify an address. Answered 252, which neither confirms nor denies |
AUTH | Authenticate |
STARTTLS | Upgrade the connection to TLS |
QUIT | Close 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
| Code | Category | Description |
|---|---|---|
2xx | Success | Command completed successfully |
3xx | Intermediate | Command accepted, more input needed |
4xx | Transient Error | Temporary failure, retry possible |
5xx | Permanent Error | Command failed, do not retry |
RFC 5321 also defines a 1xx class, which SMTP itself does not use.