Let’s get straight to the point — IMAP vs SMTP. How are these protocols different?
IMAP and SMTP are the most popular protocols for establishing connections via email between transferring parties. One of them is for receiving emails, and the other is for sending emails.
I’ll review both in this article and help you see the exact differences between the two.
So without further ado, let’s get to it!
What is SMTP?
Simple Mail Transfer Protocol, or SMTP, is an internet protocol for email sending. It defines how the message gets from the sender to the email server.
SMTP is also used by mail transfer agents (MTAs) to make the transfer of emails between different servers and computer networks possible. This process is called mail relaying, which you can read more about in our SMTP relay article.
The latest version of SMTP is defined by RFC 5321, which updates the earlier versions, such as RFC 821.
How does SMTP work?
- An SMTP client client initiates a Transmission Control Protocol (TCP) connection, or TCP/IP, with the SMTP server
- The SMTP server responds with a greeting (code 220) and an opening message (code 250), also known as “SMTP handshake”
- The client identifies itself with a HELO command and identifies itself, giving the server details such as the email and IP address
- The server responds with code 250 again, the email transfer stage begins, and email headers and contents are transferred from the client to the SMTP server
- If the transaction is successful, the SMTP email client initiates the termination of the connection, and the server closes the transmission channel
Here’s an analogy for you to get a better idea of how SMTP works.
Let’s imagine that you (the client) want to send a letter to your friend. Naturally, you go to the post office, wait in line for a bit, and you greet the clerk responsible for delivery (SMTP server).
You ask the clerk if they can send the letter (email) for you. The clerk tells you yes, and you give them the letter . They check if your and your recipient’s addresses are valid, and then dispatch the letter.
SMTP ports
- Port 25
The original and standard port for SMTP communications and relaying messages between email servers. It is blocked by many Cloud hosting providers and email clients like Gmail, Microsoft Outlook, Thunderbird, Yahoo, etc., to prevent spam.
ISPs and Cloud providers instead prefer ports 465 and 587 as they’re more secure.
- Port 465
Initially designated for SMTPS (SMTP over SSL), this port is not compliant with RFC, and it has never been recognized as an official SMTP transmission channel, although it was registered by the Internet Assigned Numbers Authority (IANA).
However, it is still used by some services for SMTP over SSL/TLS connection.
- Port 587
The preferred port for email client submissions to the email server, port 587 is used in combination with STARTTLS to upgrade the connection to a secure one with TLS encryption, making it ideal for securing email data during transmission.
It’s important to note that this port is supported by most mail servers nowadays.
- Port 2525
Although it’s an unofficial SMTP port, every email service provider supports port 2525. It is secured like 587, so many people opt for it instead when 587 is causing some problems.
If you’re interested in learning more, check out our in-depth tutorial on SMTP ports.
What is IMAP?
Unlike SMTP, which is responsible for outgoing email, the Internet Message Access Protocol, or IMAP, is a protocol for receiving messages. Put simply, IMAP enables email clients to access and retrieve messages from servers over a TCP/IP connection.
It works similarly to cloud email as it stores your messages on the mail server and synchronizes any changes you make across all of your clients. But, you can also download a copy of your message to your local machine, while the original will stay on the server unless you delete it.
The latest version of the IMAP protocol is defined by RFC 3501.
How IMAP works
- The connection between a client and the server is defined by IMAP through a series of commands
- The recipient’s email client connects to the server where the email is stored
- The recipient can see and manage the displayed message headers via the mail client
- IMAP stores a copy of a message that the recipient wants to open
- The transmission channel is closed when the client disconnects or goes offline
And again, let’s use an analogy for easier understanding.
Remember your friend to whom you sent the letter with SMTP? Well, once they receive the letter, their post office clerk (IMAP server) will allow them to read, organize, or delete the letter while they’re at the post office or take a copy of it home.
Moreover, your friend’s post office clerk will update their other mailboxes (email clients), syncing them so they can view your mail from different locations.
IMAP ports
- Port 143
Port 143 is the default port that’s less secure as it’s not encrypted. This means that usernames, passwords, and other sensitive information are vulnerable to cyber attacks during transmission.
Due to its lack of security, port 143 isn’t recommended for external networks, which is why it’s often used in internal networks where encryption isn’t a big concern.
- Port 993
Also known as IMAPS, port 993 is the more secure and used of the two IMAP ports. It allows communication over an SSL/TLS connection, securing any sensitive data during transmission.
Port 993 is the standard among most webmail service providers and clients nowadays.
Difference between IMAP and SMTP
See the table below for the many differences between SMTP and IMAP:
SMTP | IMAP |
A push protocol for sending messages. | A pull protocol that allows clients to fetch messages. |
Used by MTAs for sending emails from a client to a server or between servers. | It’s an MAA (Message Access Agent) used for retrieving and managing emails on a server. |
Listens on ports 25, 465, 587, and 2525. | Listens on ports 143 and 993. |
Transmits emails to the recipient’s server instead of storing them. | Stores emails on the server, making it possible for multiple clients to manage them. |
Limited to only email sending functionalities, but is also capable of supporting notification mechanisms, authentication, spam control, mail queue management, etc. | Limited to receiving email messages, but also supports email synchronization, folder management such as flagging messages, searching through emails on the server, etc. |
Which email protocol should you choose?
The thing with SMTP and IMAP is that you can’t really choose between the two protocols because they work together.
When you send your email, SMTP will deliver it from your email client to an email server. Then, that email server will transmit the message with SMTP to the recipient’s receiving email server, from which their email client will fetch it with IMAP.
So, the two protocols essentially go together like bread and butter.
But what you can choose is the butter you use. 🧈
Namely, IMAP has an alternative, called Post Office Protocol 3, or POP 3 for short. This is another popular email retrieval protocol that only downloads messages from the server to a single device, and instead of keeping them on the server, deletes them.
Albeit simpler than IMAP, POP3 protocol has many advantages and use cases (e.g., it’s more suitable than IMAP if you don’t have a stable internet connection).
Read more about the differences between the two protocols here, or check out our YouTube video:
Wrapping up
And that settles it. SMTP vs IMAP— there is no clear winner because you can’t separate the two.
But is there a way for you to know that these protocols will actually do their job and that your emails will be delivered where and when they’re supposed to? Actually, yes, there is.
Mailtrap email delivery platform, which combines Email Testing and Email Sending services through SMTP/API to make sure your emails reach your recipient’s inboxes in time.
And if you feel like learning even more about email infrastructure, you can check out our article on the differences between SMTP, IMAP, and POP3.
Thanks for reading!