1. Introduction
In this tutorial, we’ll study the differences between POP3 and IMAP. We can use both POP3 and IMAP protocols for retrieving emails from an email server. However, they work in different ways. Therefore, understanding their differences is critical to retrieve emails properly.
In short, the main difference is: when we use POP3, only the emails from the inbox are retrieved, and no copy is kept on the server, while when we use IMAP, the emails are retrieved from any folder (including the inbox), and a copy of each email is kept on the server.
In order to allow a deeper understanding of the differences, we’ll first understand when we need to use these protocols. So, we’ll learn how they work. Finally, we’ll systematically compare the two protocols.
2. When Do We Need To Use Protocols Such as POP3 or IMAP?
Emails are stored on so-called mail servers. Usually, we can access the emails stored on a server through a web interface (a website). Please see our article Sending Emails From Terminal In Linux for an overview of the architecture of a mail system.
But for better control, we can use email client software like Microsoft Outlook, Mozilla Thunderbird, and others. An email client uses protocols like POP3 and IMAP so that we can retrieve emails stored on the server to our local device. The way we retrieve emails differs between these two protocols.
Therefore, when using an email client, we need to decide which protocol is ideal for our needs. So let’s understand how these protocols work to make the best decision.
3. How Does POP3 Work?
POP3 (Post Office Protocol – Version 3) is the simplest one. It just downloads the emails in the inbox folder on the email server to your device. This means that POP3 doesn’t retrieve emails located in other folders such as Sent, Drafts, custom folders, and so on.
Also, when we use POP3, by default, the emails downloaded to our device are automatically deleted from the server. So consider that we’ve multiple devices with an email client connected to the same account. In this case, only the first device that connects to the server will download the emails contained in the inbox.
The figure below shows such a situation. First, Emails A and B arrived at the server. Then Client 1 retrieved both emails and then disconnected. So, the server did not keep any emails. Next, Email C came to the server. A moment later, when the server communicated with Client 2, it retrieved only Email C. Thus, we have Client 1 with Emails A and B and Client 2 with only Email C:
For more detailed information about POP3, please see RFC 1939.
4. How Does IMAP Work?
IMAP (Internet Message Access Protocol) is the most sophisticated. It’s able to synchronize emails located in any folder on the email server across multiple devices. So all devices connected to the account reflect changes made on one device, such as deleting or moving an email to a custom folder.
The figure below shows this behavior. We’ve all devices with the same emails, regardless of when the emails arrive or when each device connects:
When we use IMAP, copies of the emails and attachments are downloaded on demand so we can view them, but the original emails are kept on the server. In short, we can say that we access the emails directly on the server due to their synchronization.
For more information about IMAP, please see RFC 9051.
5. Comparison
Let’s examine some points of the two protocols.
5.1. Storage Mode
The way email is stored is the main difference between the two protocols. POP3 keeps the emails on the client’s device. IMAP, on the other hand, keeps the emails on the server.
Therefore, using POP3, we can access and modify the downloaded emails even when we’re offline. But when using IMAP, we can’t even view the emails if we’ve no connection to the server.
IMAP, therefore, requires more storage space on the server because we keep the emails until we explicitly delete them. Instead, the emails are automatically deleted as soon as they’re downloaded, which tends to free up more space on the server in the case of POP3.
5.2. Organization
IMAP allows us to organize emails into customized folders. So, each device connected to the same email account syncs all default and custom folders. IMAP also supports flags that make it easy to track the status of the message. For instance, we can know if an email has been read or not, replied to, or is a draft.
POP3, however, treats the mailbox as a single storage folder and doesn’t download any folders other than the inbox. Also, POP3 doesn’t allow us to organize emails by flags.
5.3. Search Engine
POP3 doesn’t have any mechanism that allows us to search for email.
However, we can search for locally downloaded emails just by using the search engine offered by the email client software. But in this case, the search will only consider emails downloaded by the local device. Emails that may only be present on other devices connected to the same account will be ignored.
In contrast, IMAP provides a mechanism for server-side searches. Using it, we can ask the server to search for emails meeting various criteria. This way, the search will consider all the emails in the mailbox, not just on the local device.
5.4. Security
Natively, POP3 offers encryption only for the email content and uses the MD5 algorithm. Also, POP3 offers no protection for login information, such as passwords. IMAP, in contrast, offers protection for all data using the TLS protocol, including email content and passwords.
5.5. Performance
IMAP is faster than POP3 at presenting an overview of our mailbox. This is because when we open the mail client software using POP3, each email from the inbox needs to be completely downloaded before it can be listed. However, when using IMAP, the mail list is built up only by downloading data from fields such as subject and sender.
Conversely, POP3 is faster than IMAP at presenting the contents of an email. The reason is that when using POP3, an email listed in our email client software has already been completely downloaded.
With IMAP, we download the content of an email only when we click on it. This can take considerable time, depending on the amount of text and especially the size of any attached files.
5.6. Summary
The table below summarizes the main differences between POP3 and IMAP.
Feature
POP3
IMAP
Storage Mode
Stores messages on the client device
Stores messages on the server
Offline Access
Allows for offline access to previously downloaded messages
Requires an internet connection to access messages
Synchronization
Doesn’t sync email messages across devices
Syncs email messages across multiple devices
Organization
Doesn’t offer folder organization features
Allows for the organization of emails into customized folders on the server and supports flags
Search Engine
Doesn’t have any mechanism for search
Provides a mechanism for server-side searches
Security
Encrypt only the email contents using MD5
Offers protection for all data using the TLS protocol
Performance
Fast to presenting the contents of emails
Fast to presenting an overview of emails
6. Conclusion
In this article, we studied the differences between POP3 and IMAP. We can conclude that POP3 offers only basic features for retrieving email from a server, while IMAP offers us much more control.
So, in general, POP3 is best suited for users who only access their email from one device. IMAP is a better option for users who need to access their email from one or more devices and want to keep their email synchronized between all devices connected to the account.