The difference between SMTP and IMAP in email protocols

The difference between SMTP and IMAP in email protocols

Author: Li Jiabin, Unit: China Mobile Smart Home Operation Center

Labs Guide

As mobile office becomes more and more popular, various industries in my country are gradually entering the stage of digital transformation. Email has gradually become the most important means of publishing important information, implementing various minutes, and recording important links in the mobile office system. So how do emails interact and transmit? What is the email protocol? As the two most commonly used email protocols, SMTP and IMAP, what are the differences between them? This article will give a simple and in-depth introduction to these issues.

The era of digital transformation

Mobile office systems are becoming more and more popular

The cost of communication is getting lower and lower~

In the process of information circulation and sharing

A large number of companies have chosen 📨

......

As a carrier of important information exchange

How do emails interact with each other?

What are the differences between different email protocols?

This issue of Labs introduces you to

Things about email protocols 📩

Part 01 What is the email protocol

Before introducing the email protocol, let's first briefly introduce what a communication protocol is. In simple terms, a communication protocol is a set of standardized rules used by electronic devices to interact. All parties encapsulate and parse data according to this rule. The most common communication protocols include TCP/IP, HTTP Hypertext Transfer Protocol, UDP User Datagram Protocol, FTP Text Transfer Protocol, etc. Email protocol, as the name suggests, is the standard rules used in the process of email interaction.

- Classification

The protocols used in email communication are currently divided into the following three categories:

  • SMTP: Simple Mail Transfer Protocol.
  • IMAP: Internet Message Access Protocol.
  • POP: Post Office Protocol.

The following diagram shows a basic process of email interaction.

Part 02 What is SMTP

- introduce

SMTP (Simple Mail Transfer Protocol) is a simple mail transfer protocol and an industry standard protocol in email protocols. It is mainly used to regulate the transmission of emails from the source address to the destination address and control the way emails are transferred. This protocol is used when drafting emails and initiating a send command or transferring emails. There are two types of SMTP email servers: relayers and receivers. SMTP relayers process emails from other servers and then pass them to other SMTP servers in the correct direction. Receivers receive emails sent from relay servers and then deliver them to the mail server where the recipient's mailbox is located. The following is a diagram of the stages involved in SMTP.

- Three stages of communication

The communication model of SMTP protocol communication can be simply summarized as follows: when a user needs to send an email, the email sender and the email receiver establish a communication channel. After the channel is established, the sender sends the email data through various commands. After the email is sent, the communication channel is terminated. Next, we will talk about each step in detail.

SMTP Handshake

The SMTP client and server need to establish a connection first. The client applies to establish a TCP connection with the server through port number 25. The server responds 220 and returns the server domain name. After receiving the response code, the client sends a HELLO command and client identification information to start the SMTP session channel. The server responds with a 250 response code, and the session channel is officially established.

Email transmission

The client sends the MAIL command to report the sender's email address and domain name. If the recipient accepts the email, it will reply with a reply code of 250. Then the client sends the RCPT command to specify the recipient's email address and domain name. If it is accepted, it will also reply with a reply code of 250. If it is not accepted, it will be rejected (the entire call will not be terminated). After the recipient's email address is confirmed, the client uses the DATA command to indicate that it wants to send data. The server responds with a reply code of 354. The client starts to transmit the message and ends the transmission with a ".". If the data is received, a reply code of 250 will be received.

Closing a channel

The client sends the QUIT command to close the channel, and the server responds with a 221 response code indicating successful closure.

- Features

  • SMTP supports "mail relay" and provides conditions for email forwarding.
  • SMTP supports multiple communication methods.
  • SMTP's error handling capabilities are unique, and it takes the necessary steps to successfully respond to erroneous requests.
  • SMTP can be configured as a mail gateway.

Part 03 What is IMAP

- introduce

IMAP (Internet Message Access Protocol) is an application layer protocol and a temporary mail access protocol, also known as the Interactive Mail Access Protocol and the Internet Mail Access Protocol. IMAP is not used to send mails, but is mainly used to manage mails and retrieve emails from the server, obtain email information, download emails, etc. It is the most commonly used protocol for retrieving mails. Another commonly used protocol for retrieving mails is POP3. Compared with POP3, IMAP can directly operate server mails through the client, without downloading all mails to the local computer for management. IMAP pulls through port 143, as shown in the figure below.

- Communication Process

  • The recipient's email client connects to the email server;
  • The recipient checks the email header on the server;
  • When the SMTP transmission response is successful, the recipient's email client will obtain the message through IMAP and save it to the recipient's inbox;
  • When you start reading mail, IMAP starts downloading it.

- Features

  • IMAP ensures that users can receive emails on multiple devices.
  • IMAP uses a delayed download method, which means that if the email is not opened, IMAP will not download it. This mechanism also ensures that it is easier to download multimedia files.
  • IMAP provides tags to keep track of email messages that are being viewed.
  • IMAP also has a disadvantage. When the network is poor, users may not be able to read emails correctly.

Part 04 The differences and complementarities between SMTP and IMAP

Now we can summarize the main differences between SMTP and IMAP.

  • SMTP stands for Simple Mail Transfer Protocol, whereas IMAP stands for Internet Access Message Protocol.
  • SMTP is only used to send messages, while IMAP cannot be used to send messages but can be used to manage and retrieve messages.
  • SMTP can be used to transfer messages between a client and a server, and between two servers. But IMAP only supports transferring messages from a server to a client.
  • SMTP allows you to organize emails on client storage, while IMAP users have the flexibility to organize and manage mail on the server.
  • SMTP works on port 25 (standard port for email transmission), 587 (TLS encryption), 465 (can be used when sending secure messages), 2525 (can be used when sending non-encrypted emails). On the other hand, IMAP works on port 993 (secure TLS/SSL port, also known as IMAPS), port 143 (default port).
  • IMAP provides users with a lot of flexibility and access through multiple devices, while SMTP allows emails to be altered after they have been successfully sent.

Of course, in actual use, as shown in the figure below, we use SMTP and IMAP in a complementary manner.

<<:  Principles and Applications of Distributed System Selenium GRID

>>:  5G and 6G spectrum comparison

Recommend

Hang Seng Bank launches new generation digital financial infrastructure LIGHT

On October 24, the 2020 Hang Seng LIGHT Developer...

How IPv6 will gradually replace IPv4

Have you noticed that many apps now have a line o...

Learn how to use IPv6 to surf the Internet in five minutes

1. Introduction to IPv6 As the technical foundati...

SD-WAN vs. VPN: How Do They Differ?

When it comes to comparing SD-WAN vs. VPN service...

How to set IP in CentOS9

Just for record, I found that there are still hug...

New optical spiral technology can increase information transmission rate tenfold

A new optical-based communications tool can trans...

Microsoft is exploring high-speed wireless networks in data centers

In a recent filing with the Federal Communication...

Cloud computing, IoT and SDN pose the biggest challenges to enterprise networks

According to a new report released by Kentik, clo...

Slow Internet speed, poor WIFI signal? This is how you can operate your router

Perhaps when you are working, you will encounter ...