IMAP and SMTP are involved in transferring an electronic message. These are the sender, recipient, and a mail server. The email goes from the sender to the mail server. Then it lets the recipient get the message. What is the role of email protocol here? It establishes connections between transferring parties. So, one protocol is needed to send, and one – to receive. Today, we’ll review the two most commonly used email protocols – SMTP, IMAP to help you choose the right option for your purposes.
SMTP – a protocol to send emails
Simple Mail Transfer Protocol (SMTP) establishes how the message gets from the sender to the email server. Also, it is used by a mail transfer agent (MTA) to deliver email between servers – mail relaying. SMTP is meant only to send emails.
How SMTP works
SMTP workflow consists of commands sent by the SMTP client and corresponding replies by the SMTP server. Commands are text-based like HELO, MAIL FROM, and others. Also, there can be used extended SMTP (ESMTP) commands like EHLO, STARTTLS, etc. Replies are represented by numeric completion codes like 220, 250, 354, and so on. For more on SMTP commands and response codes, read our dedicated blog post.
Any SMTP conversation consists of three stages:
SMTP handshake – The SMTP client establishes a TCP connection to the SMTP server. Once the server replies with 250, the hand shaking starts. The stage ends when the server confirms the recipient’s address.
Email transfer – Code 354, as a response to the DATA command, launches the transfer of the email. Once the server gets a final dot, the message is transferred.
Termination – Client and server say goodbye to each other using the command QUIT and the code 221 respectively.
Let’s take a look at the interaction between the SMTP client and server through a simple email delivery example:
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:
There are three forms of IMAP server responses
- Status Responses (
They may include a response code like
CAPABILITY. A response code gives additional information beyond the status response condition.
- Server Data
These responses include Server and Mailbox Status (
LIST, etc.), Mailbox Size (
RECENT), and Message Status (
- Command Continuation Request
This response confirms that the server is ready to accept the continuation of the client’s command. It is by a “
You may like:
- Sitemap: The importances and how to generate it in Magento 2
- 502 Bad Gateway Error: Simple Explanation and How To Fix
IMAP Vs. SMTP
The main difference between SMTP and IMAP is the function that they play. SMTP is the protocol for sending email whether it is from the client or in between servers for propagating the email towards the intended destination. In comparison, IMAP is a protocol that deals with managing and retrieving email messages from the server. So if you are using email, you are probably using both protocols even if you don’t know it.
Another key difference between SMTP and IMAP is where it is used. IMAP is used only between the client who is retrieving the email and the server where the emails are stored. In contrast, SMTP is used by the client to send emails to a server. But it is also used by servers to push the email to another server. It is especially true when the sender and recipient do not subscribe to the same service provider.
IMAP is only one of the many protocols for retrieving email. Another one is POP3. These two are the most popular protocols for retrieving email. It comes with IMAP being the more powerful of the two. But due to prior support for POP3 in older devices, it is still in widespread use today. SMTP is undisputed the most prevalent protocol for sending emails. Although there are other outgoing email protocols, SMTP is the most popular and widely used.
For browser based email services, there is really no need to mess with or even know the protocol being used or the exact addresses used for these protocols. Knowing these details only becomes relevant when you are using another client like Microsoft Outlook or Mozilla Thunderbird to send and receive your emails. Depending on your service providers, you can get two relevant addresses. One for SMTP and another for either IMAP or POP3. These addresses should be configured correctly into your client or you would not be able to receive emails, send emails, or both.
- SMTP is used for sending emails while IMAP is used for retrieving emails
- SMTP is used between servers while IMAP is only used between client and server
- SMTP is the prevalent protocol for outgoing email while IMAP is only one of two prevalent protocols for email retrieval
Level up your website with ArrowHiTech – official partner of Magento
Our own Magento development support services is plus the option for monthly support packages. It is to make sure your online business always remains in top form. And of course, there are countless other developer websites that can be easily found and perused as well.
Our Magento services:
ArrowHiTech Development Agency
With over 12 years of operation, ArrowHiTech is official Magento’s partner. We has increasingly widened our skills and resources to meet all the requirements of customers all over the world on Web design and development with flexible and reasonable price!
- Headquarter: Vietnam
- Website: https://www.arrowhitech.com/
- Contact: firstname.lastname@example.org