5. The TRANSACTION State
Once the client has successfully identified itself to the POP3 server and the POP3 server has locked and opened the appropriate maildrop, the POP3 session is now in the TRANSACTION state. The client may now issue any of the following POP3 commands repeatedly. After each command, the POP3 server issues a response. Eventually, the client issues the QUIT command and the POP3 session enters the UPDATE state.
Here are the POP3 commands valid in the TRANSACTION state:
STAT Command
Arguments: none
Restrictions: may only be given in the TRANSACTION state
Discussion: The POP3 server issues a positive response with a line containing information for the maildrop. This line is called a "drop listing" for that maildrop. The positive response consists of "+OK" followed by a single space, the number of messages in the maildrop, a single space, and the size of the maildrop in octets. Messages marked as deleted are not counted in either total.
Possible Responses:
+OK nn mm
Examples:
C: STAT
S: +OK 2 320
LIST Command
Format: LIST [msg]
Arguments: a message-number (optional), which, if present, may NOT refer to a message marked as deleted
Restrictions: may only be given in the TRANSACTION state
Discussion: If an argument was given and the POP3 server issues a positive response with a line containing information for that message. If no argument was given and the POP3 server issues a positive response, then the response is multi-line, with one line per message in the maildrop.
Possible Responses:
+OK(followed by message listing)
Examples:
C: LIST
S: +OK 2 messages (320 octets)
S: 1 120
S: 2 200
S: .
RETR Command
Format: RETR msg
Arguments: a message-number (required) which may NOT refer to a message marked as deleted
Restrictions: may only be given in the TRANSACTION state
Discussion: If the POP3 server issues a positive response, then the response is multi-line. After the initial +OK, the POP3 server sends the message corresponding to the given message-number, being careful to byte-stuff the termination character (as with all multi-line responses).
Possible Responses:
+OK(followed by message content)-ERR
Examples:
C: RETR 1
S: +OK 120 octets
S: <the complete message content>
S: .
DELE Command
Format: DELE msg
Arguments: a message-number (required) which may NOT refer to a message marked as deleted
Restrictions: may only be given in the TRANSACTION state
Discussion: The POP3 server marks the message as deleted. Any future reference to the message-number associated with the message will result in an error. The POP3 server does not actually delete the message until the UPDATE state is entered.
Possible Responses:
+OK-ERR
Examples:
C: DELE 1
S: +OK message 1 deleted
NOOP Command
Arguments: none
Restrictions: may only be given in the TRANSACTION state
Discussion: The POP3 server does nothing, it merely replies with a positive response.
Possible Responses:
+OK
Examples:
C: NOOP
S: +OK
RSET Command
Arguments: none
Restrictions: may only be given in the TRANSACTION state
Discussion: If any messages have been marked as deleted by the POP3 server, they are unmarked. The POP3 server then replies with a positive response.
Possible Responses:
+OK
Examples:
C: RSET
S: +OK maildrop has 2 messages (320 octets)
Glossary:
- TRANSACTION state: Main operational phase
- drop listing: Summary of mailbox status
- byte-stuff: Method to escape special characters
- message-number: Numeric identifier for messages
- octets: 8-bit bytes