RFC 918

Post Office Protocol

πŸ“… published October 1984, from ietf

POST OFFICE PROTOCOL πŸ’Œ

Title block, the tea β˜•

  • RFC: 918
  • Title: POST OFFICE PROTOCOL
  • Author: J. K. Reynolds, ISI
  • Date: October 1984
  • Status: experimental, a proposed protocol for the ARPA-Internet community πŸ§ͺ
  • Obsoletes / Updates: nothing listed, so this one isn't replacing or patching any other RFC 🫢

Status of this Memo

Okay so this RFC is basically suggesting a simple way for workstations to dynamically grab mail from a mailbox server πŸ“¬ It's a proposed protocol for the ARPA-Internet community, and the author is literally begging for discussion and suggestions to make it better πŸ₯Ή

Introduction

The whole point of the Post Office Protocol (POP) is to let a user's workstation access mail from a mailbox server πŸ¦‹ Mail is expected to be posted from the workstation to the mailbox server through the Simple Mail Transfer Protocol (SMTP). If you want the deets on that, check out RFC-821 [1] and RFC-822 [2] πŸ“–

Its status is experimental, and it depends on TCP 🧡

The Protocol

The server is the one waiting around for a connection πŸ‘€ When a connection opens, the server sends a greeting and then waits for commands. When commands come in, it acts on them and sends back replies πŸ’…

The client opens a connection and waits for that greeting, then sends USER and then PASS to get authorized to access mailboxes πŸ”‘ Next, the client starts a mail reading transaction with either RDEL (read and delete all messages from a mailbox) or RETR (just read all the messages without deleting anything) πŸ“₯ The server opens and locks the mailbox and replies with the number of characters in it πŸ”’ Then the client asks for the data by sending RCEV, and the server sends the mail data 🎁 Once all the data has arrived, the client sends RCVD. If the transaction started with RDEL, the server now deletes the mail data from the mailbox πŸ—‘οΈ Either way, the server closes and unlocks the mailbox πŸ”“ Finally, the client ends the session with QUIT πŸ‘‹

The Normal Scenario

It's giving sequence diagram energy 🀩

        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)

Definitions of Commands and Replies

Here's where it gets spicy 🌢️ This is the official list of everything you can say and everything you can get back πŸ’–

Summary of Commands and Replies

   Commands                          Replies
   --------                          -------
   USER name                         +OK
   PASS password                     -Error
   RETR mailbox                      #xxx
   RDEL mailbox
   RCEV
   RCVD
   QUIT
   NOOP
   RSET

Commands

USER name

This command identifies the user to the server πŸͺͺ It MUST be followed by the PASS command, no exceptions bestie 🚫

Possible responses: +OK or -ERR ✨

PASS password

PASS carries the password that authenticates this user πŸ” Together, the USER name and PASS password are how the server controls access to the mailboxes 🏰

Possible responses: +OK or -ERR ✨

RETR mailbox

This command starts a mail reading transaction πŸ“– RETR is for reading all the messages in a mailbox without deleting them 🌸 It MUST be followed by the RCEV command πŸ’…

Possible responses: #xxx or -ERR ✨

RDEL mailbox

This command also starts a mail reading transaction 🧹 RDEL reads all the messages in a mailbox AND deletes them, so be careful with it πŸ™ˆ It MUST be followed by the RCEV command πŸ’…

Possible responses: #xxx or -ERR ✨

RCEV

This one is the client's "I'm ready, send it" moment πŸ™Œ It confirms the client is ready to receive the mail data. It MUST be followed by the RCVD command πŸ’…

Possible responses: +OK or (connection aborted) πŸ’€

RCVD

RCVD confirms that the client has received and accepted the mail πŸ“¬ It ends the mail reading transaction 🏁 With an RDEL transaction, the mail is not necessarily deleted. That shows up as an error reply, so check your replies πŸ‘€

Possible responses: +OK or -ERR ✨

QUIT

QUIT means the client is done with the session πŸ‘‹ The server sends an OK, then closes the connection πŸšͺ

Possible response: +OK then Close πŸ¦‹

NOOP

NOOP is the no operation command, which means it does absolutely nothing except send back an OK 😴 Iconic behavior, honestly πŸ’…

Possible response: +OK ✨

RSET

RSET makes the server abort the current transaction and go back to waiting for a command (one of RDEL, RETR, QUIT, NOOP, or RSET) πŸ”„ When aborting, the server MUST take care to properly close and unlock the mailbox πŸ”“ No leaving things hanging, periodt πŸ’€

Possible response: +OK ✨

Acknowledgment

The author wants to give a big shoutout to Jon Postel, Joel Goldberger, Dale Chase, and Michael Butler for helping develop the Post Office Protocol 🫢🌈

References

[1] Postel, J., "Simple Mail Transfer Protocol", RFC-821, USC/Information Sciences Institute, August 1982. πŸ“š

[2] Crocker, D., "Standard for the Format of ARPA-Internet Text Messages", RFC-822, University of Delaware, August 1982. πŸ“š

Diagram

Here's the whole flow in one picture, and it's giving main character energy πŸ¦‹

         +---+      +---+       +---+       +---+       +---+
   Open  |   | +OK  |   |       |   | +OK   |   |       |   | +OK
   ----->| S |--+-->| C |------>| S |------>| C |------>| S |---->+
         |   |  ^   |   | USER  |   |       |   | PASS  |   |     |
         +---+  |   +---+       +---+       +---+       +---+     |
                |                 | -ERR                  | -ERR  |
                |                 V                       V       |
   +<-----------+<----------------+<----------------------+       |
   |                                                              |
   V      +---+       +---+                                       |
   +----->|   | QUIT  |   | +OK                                   |
          | C |------>| S |----->Close                            |
   +----->|   |       |   |                                       |
   ^      +---+       +---+                                       |
   |                                                              V
   +<-------------------------------------------------------------+
   |                                                              ^
   |  +---+     +---+      +---+     +---+     +---+     +---+    |
   |  |   |RETR |   | #xxx |   |RECV |   |DATA |   |RCVD |   |+OK |
   +->| C |---->| S |----->| C |---->| S |---->| C |---->| S |--->+
   |  |   | or  |   |      |   |     |   |     |   |     |   |    ^
   |  +---+ RDEL+---+      +---+     +---+     +---+     +---+    |
   |              | -ERR     |         |         |         | -ERR |
   |              V          |         V         |         |      |
   +<-------------+          |       Abort       |         |      |
   |                         V                   V         V      |
   |        +<---------------+-------------------+         +----->+
   |        V
   |      +---+       +---+
   |      |   | RSET  |   | +OK
   +----->| C |------>| S |----->+
   |      |   |       |   |      |
   |      +---+       +---+      |
   |                             V
   +<----------------------------+
   |                             ^
   |      +---+       +---+      |
   |      |   | NOOP  |   | +OK  |
   +----->| C |------>| S |----->+
          |   |       |   |
          +---+       +---+
πŸ“¦ where this page comes from