Post Office Protocol - Version 3
obsoleted by
- rfc-1939 — Post Office Protocol - Version 3
obsoletes
- rfc-1460 — Post Office Protocol - Version 3
Extracted elements (26)
STAT and LIST response formats are intentionally constrained (discouraging extra fields) to simplify parsing. Minimal implementations end the response line with CRLF; the NOTE in sections 5 strongly discourages extra information in drop and scan listings.
The protocol philosophy places intelligence in the POP3 client, not the server. Optional commands (TOP, UIDL) are strongly encouraged over augmenting drop/scan listings with extra fields, so that servers remain simple and clients handle parsing.
All messages transmitted during a POP3 session are assumed to conform to RFC 822 (Internet text message format). POP3 itself imposes no message-structure parsing requirements on the server beyond octet counting.
The octet count reported by the server for a message may differ from its actual on-disk size because local line-ending conventions (e.g., LF-only) differ from the CRLF convention used on the wire. Servers must account for this when computing message sizes.
A POP3 server MAY have an inactivity autologout timer, but if implemented it MUST be of at least 10 minutes' duration. On expiry, the server closes the TCP connection without entering UPDATE state, without removing messages, and without sending a response.
If a POP3 session terminates for any reason other than a client-issued QUIT command, the session MUST NOT remove any messages from the maildrop; the UPDATE state is not entered.
Message-numbers are assigned sequentially starting at 1 when the maildrop is opened; all message-numbers and sizes in POP3 commands and responses MUST be expressed in decimal (base-10).
Once authentication succeeds, the POP3 server MUST acquire an exclusive-access lock on the maildrop to prevent messages from being modified or removed before the UPDATE state. If the lock cannot be acquired, the server responds with -ERR and may close the connection.
The APOP timestamp MUST be different each time the POP3 server issues a greeting banner, ensuring per-session uniqueness for replay protection.
The POP3 server MUST listen on TCP port 110 for incoming client connections.
The APOP command (AUTHORIZATION state) provides challenge-response authentication. The server includes an RFC 822 msg-id timestamp in its greeting banner; the client replies with APOP name digest where digest is MD5(timestamp + shared-secret) encoded as 32 lower-case hex characters.
The DELE command (TRANSACTION state) marks a message as deleted; the server does not actually remove it until the UPDATE state. Any subsequent reference to the marked message-number generates an error.
The LIST command (TRANSACTION state) returns scan listings in the format 'msg-number size-in-octets'. With no argument it returns a multi-line response for all non-deleted messages; with a message-number argument it returns a single-line scan listing for that message.
The optional TOP command (TRANSACTION state) sends the message headers, the blank separator line, and the first n lines of the body as a multi-line response. If n exceeds the body length, the entire message is returned.
The optional UIDL command (TRANSACTION state) returns unique-id listings. Each listing is 'msg-number unique-id', where the unique-id is a server-assigned string of printable ASCII characters (0x21–0x7E) that persists across sessions and is never reused within a maildrop.
The PASS command (AUTHORIZATION state, after successful USER) takes a password string. Because the command has exactly one argument, servers MAY treat embedded spaces as part of the password rather than as argument separators.
The RETR command (TRANSACTION state) retrieves the full RFC 822 message corresponding to the given message-number as a multi-line response, with termination-octet byte-stuffing applied.
The RSET command (TRANSACTION state) unmarks all messages previously marked as deleted, restoring them to active status for the remainder of the session.
The STAT command (TRANSACTION state) returns a drop listing: '+OK' followed by the message count and total maildrop size in octets. Messages marked as deleted are excluded from both totals.
The USER command (AUTHORIZATION state) takes a mailbox name as its sole argument. If the server responds +OK, the client may issue PASS to complete authentication or QUIT to abort. A -ERR response allows the client to retry with a new authentication command.
A POP3 server implementing both PASS and APOP must not allow both authentication methods for the same user; for a given username, exactly one of PASS or APOP is permitted. Shared secrets for APOP should be long strings to resist derivation.
A server that replies -ERR to the USER command reveals to potential attackers which usernames are valid, aiding enumeration attacks.
The USER/PASS authentication mechanism sends passwords in cleartext over the network. Use of RETR and TOP also transmits mail content in the clear. APOP is the alternative that avoids sending a password in the clear by using a challenge-response MD5 digest.
A POP3 session progresses through three states: AUTHORIZATION (client must identify itself), TRANSACTION (client issues commands on maildrop), and UPDATE (server releases resources and deletes marked messages). The session enters TRANSACTION after successful authentication and enters UPDATE only when the client issues QUIT from TRANSACTION state.
Multi-line responses are terminated by a line containing only a termination octet (decimal 46, '.') followed by CRLF, making the five-octet sequence CRLF.CRLF. Any response line beginning with the termination octet is byte-stuffed by prepending an additional termination octet; the client strips the leading octet when processing.
POP3 commands consist of a keyword (3–4 characters) optionally followed by arguments (each up to 40 characters), all separated by a single SPACE and terminated by CRLF. Responses consist of a status indicator (+OK or -ERR) optionally followed by text, also terminated by CRLF.