Knowledge Essentials - 3Essentials Hosting

POP email protocol overview

Article ID: 1319

 Back to Search

The following gives an overview of how an email client uses the POP protocol works to retrieve and manage messages in an email user's mailbox.

The POP protocol defines the commands and responses an email client (like Outlook, Outlook Express, Windows Live Mail, Thunderbird, etc.) and an email server will use when your email client wants to RETRIEVE a message from your mailbox, to download it into your email client.  Commands like STAT, LIST, RETR, DELE, are all commands the email client sends to the email server to control what occurs in the mailbox.

One very important thing to note, is that it's the email client that is in charge... the mail server doesn't make any decisions, it only responds to requests from the clients.  For exmaple the email server will only delete a message out of a mailbox, if a properly authenticated email client issued the command to "delete message XYZ out of my mailbox".   So whether messages are retained on the server in your mailbox, or deleted from your mailbox, it's all under the control of the email client. 

The following illustrates commands sent and responses received in a typical email client - to - email server conversation. 


Get/delete e-mails

First, the user must AUTHENTICATE to the email server.  this simply means that they've configured their mail client with the valid email username and password, and when the email client makes the initial connection, it provides that username and password, and is confirmed by the mail server as authenticated.  Once authenticated, a variety of commands are available to obtain information about the messages within the mailbox.   Some, not all, of those commands are illustrated below.

STAT

The STAT commands tell about the mailbox content briefly:

STAT
+OK 2 2206

This output shows that there are two messages in the mailbox, and their size is 2206 bytes. It doesn’t say about each message size. In order to know which message takes what space, you’ll have to use the LIST command:

LIST

LIST
+OK 2 messages (2206 octets)
1 1273
2 933

The response reveals there 2 messages received, size of the first is 1273 bytes, and second is 933 bytes. Notice, each message is referenced by a message number.

Retreive your mail with RETR

RETR is used to, you guessed it, RETRIEVE a mail message from your mailbox.   RETR requests as argument the e-mail number you’d like to fetch.

RETR 1
+OK 1273 octets
< the POP3 server sends the entire message here >

The TOP command is useful to see the content is big e-mails, and/or is used by mail clients that just partially retrieve messages in order to "preview" the emails, without actually downloading the entire email. 

Delete E-mail with DELETE

You have to use the DELE command. The syntax is the same as RETR. (DELE 4 to delete the fourth message in the INBOX).

 If you've set your email client to DELETE messages after being downloaded, you might see a conversation look like this:

RETR 1
+OK 1273 octets

DELE 1
+OK 

If you don't have the email client DELETE messages after retrieval, it's up to the mail client to keep track of what messages it has downloaded and which ones it hasn't.   The mail server has no idea if you've downloaded a message before or not... so if you're not deleting the messages, only the mail client knows if it's downloaded a message previously or not, and knows whether to request to download it again or not. 

An example of when this might be a factor for you... let's say you use Outlook Express as your email client, and you have it configured to NEVER delete an email message, and you have years of email stored on your mailbox on the server. 

Then one day you remove the email account from Outlook Express, and add it back.  When you deleted the email account from Outlook Express, you deleted along with it Outlook Express's record of which mail messages were downloaded from that mailbox and which weren't.  So, after you've added it back and you SEND/RECEIVE again, it connects to your mailbox for (what it believes) is the first time, it has NO IDEA that it previously downloaded all those messages... and the mail server doesn't either.  So Outlook Express will simply download every mail in your mailbox... even though you'd already downloaded them before.  

 

 
Downloads Associated With This Article
No downloads are currently associated with this article.