POP

From Postmaster Administration Wiki
Jump to: navigation, search
Mail-agents.png

Post Office Protocol

POP is simple mail retrieval protocol and was used more frequently in the early days of the Internet; IMAP has come to replace it for the most part. POP3 though is still useful to administrators, because of its simplicity, making it useful for scripting, manually testing mailboxes, and creating mail service monitoring loops.

Protocol Summary

POP is a service available on port 110 and/or the SSL port 995. POP is a synchronous request-reply human readable protocol. Successful commands reply with +OK and failed commands with -ERR. Using a Telnet client one can connect to port 110 of a mail store and get a +OK welcome banner, after which the following commands can be used, starting with USER and PASS. There are other POP commands in the protocol, but those below tend to be sufficient for manual testing.

The C: And S: denote which lines are sent from the client and server respectively. They are not part of input or output.

USER username

First half of the user login credentials. Supply the username of the mailbox; this might be just a simple name like fred or johnsmith or a mail address like fred@example.com.

S: +OK POP3 mail.example.com 2007e.104 server ready
C: USER Slartibartfast
S: +OK User name accepted, password please

PASS password

Second half of the user login credentials. Supply the mailbox account password. Note that this password is supplied in clear text and can be intercepted. For this reason postmasters might disable clear text login, forcing the use of STLS on port 110 or a secure socket layer connection on port 995.

S: +OK POP3 mail.example.com 2007e.104 server ready
C: USER Slartibartfast
S: +OK User name accepted, password please
C: PASS HHgTTg
S: +OK Mailbox open, 2 messages

STLS

A POP connection on port 110 starts unencrypted. This command requests that the server start TLS, communication channel encryption. Some POP servers require TLS before accepting clear-text user authentication. It is not possible to test STLS using telnet, see Manually Test STARTTLS.

LIST [number]

Lists all the message numbers and their size (headers and content) in bytes. With an optional message number, this command lists only the size of that particular message. Note that the list changes between POP sessions depending on message deletions. The UIDL can be used to get a unique identifier for each message, but there is no direct way of looking up a message using it.

UIDL [number]

Similar to LIST and reports a unique identifier for a message. Used to map a message to its mailbox index number. Typically used by mail user agents (MUA), such as Thunderbird or Outlook, for message management.

TOP number lines

Display the top N given lines of a given message number. Handy to review just message headers, without reading the whole message.

RETR number

Retrieve a complete message (headers and content).

DELE number

Marks a given message for deletion.

RSET

Unmarks all messages marked for deletion.

QUIT

End the POP connection, deleting marked messages.

References

  • RFC 1939 Post Office Protocol - Version 3
  • RFC 5034 The Post Office Protocol (POP3) Simple Authentication and Security Layer (SASL) Authentication Mechanism (previously RFC 1734)
  • RFC 2595 Using TLS with IMAP, POP3 and ACAP
  • RFC 4616 The PLAIN Simple Authentication and Security Layer (SASL) Mechanism