Understanding the Differences Between POP3 and IMAP

Understanding the Differences Between POP3 and IMAP.

If you’re wondering how email works, then it right to have an idea about the differences between POP3 vs IMAP. In this article, we will explain in layman terms and how they work, so buckle up and keep reading!

In transferring an electronic message, three parties are involved. These are the sender, the recipient, and a server for mail. The email goes to the mail server from the sender, which then helps the recipient to get the message.

What is the email protocol’s role here? It establishes connections between parties that are transferred. So to send, one protocol is needed, and one to receive.

Today, we will review the two email protocols that are most commonly used, POP3 and IMAP, and help you choose the right option for your purposes.

What is IMAP?

Internet Message Access Protocol (IMAP) is a communication standard to access email stored on the server. Today, its fourth version is in use, so the name of IMAP4 is also widespread.

The key feature of this protocol is that the message remains on the server. It will be downloaded as soon as the recipient picks it to open. So, IMAP gets access to the email from any device or location if authorized.

This is the go-to option of most email service providers so far.

How IMAP Works

Here is the basic flow of the IMAP client/server interaction:

  • A recipient’s email client connects to the server the message is stored on
  • The recipient can see the headers of all the messages on the server
  • If the recipient chooses a particular message to read, IMAP downloads it on demand

Under the hood, a primitive IMAP connection may look as follows:

Client command Description
LOGIN Opens the IMAP connection
LIST
CREATE
RENAME

and other commands
Commands that allow you to manage mailbox
SELECT Defines the current mailbox and opens an IMAP session
LIST
DOWNLOAD
DELETE

and other commands
Commands that allow you to manage messages
CLOSE Closes the IMAP session. If you want to open a new session, you can do this by setting another current mailbox. Once the new session is opened, the IMAP server permanently updates the messages according to the previous session.
LOGOUT Closes the IMAP connection

Here you can find a full selection of client commands.

Darn! We forgot about the IMAP server responses. There are three forms of them:

  • Status Responses (OKNOBADPREAUTH, and BYE)

They may include a response code like ALERT or CAPABILITY.  A response code gives additional information beyond the status response condition.

  • Server Data

These responses include Server and Mailbox Status (CAPABILITYLIST, etc.), Mailbox Size (EXISTS and RECENT), and Message Status (EXPUNGE and FETCH)

  • Command Continuation Request

This response confirms that the server is ready to accept the continuation of the client’s command. It is by a “+” token.

IMAP ports

  • 143

A default IMAP port without encryption

  • 993

A secured SSL/TLS port used by most email service providers. Also, it is often referred to as IMAPS.

What is POP3?

IMAP4 is a sophisticated email protocol. Post Office Protocol is a simpler way to access mailboxes. So far, the version 3 of this standard is widely used – therefore it is POP3.

Users love this protocol for its low dependency on Internet connections. POP3 downloads emails from the server to the client, so you can read them even offline. The server deletes messages once they are retrieved.

This is the default and common setting, but there is the option to enforce a site policy regarding email retention on the server.

At the same time, even if the POP3 client contains configuration options to store mail on the server, the latter in fact won’t support this.

How POP3 Works

POP3 connection consists of the four steps:

  • The client connects to the server (AUTHORIZATION State)
  • The client retrieves email (TRANSACTION State)
  • The server deletes the stored messages (UPDATE State)
  • The client disconnects from the server

Let’s take a look under the hood of a POP3 session as well.

Command or Response What it means
Server: The server is waiting for connection on TCP port 110
Client: The client establishes a TCP connection.
Server: +OK POP3 server ready <example.server.com> If everything is OK, the server’s response will be consistent. Otherwise, it will show -ERR
Client: APOP mrose c4c9334bac560ecc979e58001b3e22fb Provides origin identification and replay protection for the session. mrose is the name parameter and c4c9334bac560ecc979e58001b3e22fb is the digest parameter. They identify a mailbox and a MD5 digest string
Server: +OK  If everything is OK, the server’s response will be consistent. Otherwise, it will show -ERR
Client: STAT Now, the session enters the TRANSACTION state. STAT command asks how many messages are currently in the mailbox and their size in octets
Server: +OK 1 334 Maildrop has one message of 334 octets
Client: DELE 1 Deletes the message
Server: +OK message 1 deleted If everything is OK, the server’s response will be consistent. Otherwise, it will show -ERR
Client: QUIT Once the session is over, the client logs off via QUIT command
Server: +OK dewey POP3 server signing off (maildrop empty) If everything is OK, the server’s response will be consistent. Otherwise, it will show -ERR
Client: The client closes the TCP connection.
Server: The server is waiting for connection on TCP port 110

We used only two commands (DELE and STAT) that are valid in the TRANSACTION state. Here you can find more options.

As for POP3 responses, they contain a status indicator (+OK or -ERR) and a keyword that may be enhanced with additional information (for example, -ERR no such message, only 2 messages in maildrop).

POP3 ports

  • 110

A default POP3 port without encryption

  • 995

A secured SSL/TLS port that is often referred to as POP3S.

Which is Better?

When you set up an email address in an email client, you will need to decide if you want to set it up as POP3 or IMAP. Both of them are ways to connect to the mail server so you can read your emails through an email client.

  • IMAP is short for Internet Message Access Protocol. With IMAP, the message does not remain on the local device, such as a computer, it remains on the server.
  • POP3 is short for Post Office Protocol. With POP3 mail, it will connect and attempt to keep the mail located on the local device (computer or mobile).

IMAP is better if you are going to be accessing your email from multiple devices, such as a work computer and a smartphone. POP3 works better if you are only using one device, but have a very large number of emails.

It is also better if you have a poor internet connection and need to access your emails offline. For most people, IMAP will suit their needs better.

Add a Comment

Your email address will not be published. Required fields are marked *