Skip to main content

The Protocol

The protocol is for the server to be listening for a connection. When a connection is opened the server sends a greeting message and waits for commands. When commands are received the server acts on them and responds with replies.

The client opens a connection, waits for the greeting, then sends the USER and then the PASS commands to establish authorization to access mailboxes. The client begins a mail reading transaction with either an RDEL (to read and delete all messages from a mailbox) or a RETR (to simply read all messages from a mailbox). The server opens and locks the mailbox, and responds with the number of characters in the mailbox. Then the client asks for the data to be sent by issuing the RCEV command. The server responds by sending the mail data. When all the data has been received the client sends the RCVD command. If the transaction started with the RDEL command the server now deletes the mail data from the mailbox. In any case, the server closes and unlocks the mailbox. The client terminates the session with the QUIT command.

The Normal Scenario​

        Client                    Server
------ ------
Wait for Connection
Open Connection -->
<-- +OK
Wait for Command
USER Fred -->
<-- +OK
Wait for Command
PASS password -->
<-- +OK
Wait for Command
RDEL mailbox --> (open and lock mailbox)
<-- #xxx
Wait for Command
RCEV -->
<-- (send a copy of mail)
Wait for Command
RCVD --> (deletes mail from mailbox, unlock
and close mailbox)
<-- +OK
Wait for Command
QUIT -->
<-- +OK
Close connection --> <-- Close connection
Wait for Connection (go back to start)