POP3
Summary
Post Office Protocol 3 (POP3) - Get Mail from Server
Post Office Protocol version 3 (POP3) is a protocol used to download the email messages from a Mail Delivery Agent (MDA) server, as shown in the figure below. The mail client connects to the POP3 server, authenticates, downloads the new email messages before (optionally) deleting them.
The example below shows what a POP3 session would look like if conducted via a Telnet client.
- The user connects to the POP3 server at the POP3 default port 110.
- Authentication is required to access the email messages; the user authenticates by providing his username USER frank
and password PASS D2xc9CgD
.
- Using the command STAT
, we get the reply +OK 1 179
; based on RFC 1939, a positive response to STAT
has the format +OK nn mm
, where nn is the number of email messages in the inbox, and mm is the size of the inbox in octets (byte).
- The command LIST
provided a list of new messages on the server, and RETR 1
retrieved the first message in the list.
telnet 10.10.45.250 110
#Trying 10.10.45.250...
#Connected to MACHINE_IP.
#Escape character is '^]'.
#+OK MACHINE_IP Mail Server POP3 Wed, 15 Sep 2021 11:05:34 +0300
From: Mail Server
To: Frank
subject: Sending email with Telnet
Hello Frank,
I am just writing to say hi!
.
QUIT
#+OK MACHINE_IP closing connection
#Connection closed by foreign host.
The example above shows that the commands are sent in cleartext. Using Telnet was enough to authenticate and retrieve an email message. As the username and password are sent in cleartext, any third party watching the network traffic can steal the login credentials.
In general, your mail client (MUA) will connect to the POP3 server (MDA), authenticate, and download the messages. Although the communication using the POP3 protocol will be hidden behind a sleek interface, similar commands will be issued, as shown in the Telnet session above.
Based on the default settings, the mail client deletes the mail message after it downloads it. The default behaviour can be changed from the mail client settings if you wish to download the emails again from another mail client. Accessing the same mail account via multiple clients using POP3 is usually not very convenient as one would lose track of read and unread messages. To keep all mailboxes synchronized, we need to consider other protocols, such as IMAP.