12 May 2022 | 5 min read | Ignas Anfalovas
You are exploring: Network Engineering

What Is an Email Server? How Does It Work?

Learn how mail servers work, what the roles of SMTP, IMAP and POP are, and what an email client is with this comprehensive guide.

Two servers responsible for transmitting email messages.

Emails are so common most of us send and receive dozens each day without really thinking about them. Incoming and outgoing emails connect us to each other across the internet. Behind every email hides the humble email server

Without email servers, the bedrock of online communication would be rendered useless. So, what is an email server? The clue is really in the name: An email or mail server is a computer system with a mail transfer agent (MTA). Its main function is to send and receive emails.

By the time you’ve finished reading this article, you’ll know what a mail server is and how it works between local users. You will also be able to name the main protocols used to send and receive emails and confidently describe a mail client. Let’s get going.

How does a mail server work?

Email servers work pretty much like other kinds of servers. They are responsible for routing specific information, in this case – emails, across a network like the internet. 

Email servers rely on the IP addresses attached to emails and the DNS system to ensure that each message is routed directly across the internet to the correct recipient, regardless of the domain. 

Email server relaying a message between two people.
Email servers relay messages between senders and recipients

Depending on the server settings, any given mail server (e.g., Microsoft Exchange Server) is responsible for distributing outgoing email (like an SMTP server) or for retrieving and managing incoming email (like an IMAP server). 

As with most complex processes, it’s probably easiest if we go step by step through the complete system to show how an email message is sent, transported and received. 

  1. The sender uses a computer to sign into their email account and write a message.  As well as the message, they must include the recipient’s email address before they hit send. 
  2. The email is first sent to SMTP or outgoing email servers. Here, the server does a DNS record check to translate domain names in email addresses into IP addresses that servers can use to route the email. 
  3. If the email goes to a domain within the same network, the first server can simply route the email to the correct IMAP server. 
  4. However, if the mail is addressed to a domain on an IMAP server in a different network, the initial SMTP server will rely on unrelated SMTP servers to route the mail. 
  5. Finally, the incoming mail server uses a protocol like IMAP or POP to send all messages to the recipient’s computer. The recipient can then find the message in the inbox of their account. 
A diagram showing how a mail server sends emails from sender to recipient.
How a mail server works

Simple Mail Transfer Protocol (SMTP)

The Simple Mail Transfer Protocol is the most ubiquitous email transfer protocol. That is because it is the standard protocol for any outgoing mail server. 

When users make outgoing mail requests – i.e., hit send on an email – SMTP is the protocol that first handles the request. On sending an email, the email client opens a connection with the relevant SMTP server. 

The server then requests data from the client. That data includes:

If the email addresses are from the same domain, the same SMTP server can route mail directly on the same network to the recipient’s domain. Otherwise, the SMTP server uses the DNS to identify the correct IP address for the recipient’s email domain. 

Internet Message Access Protocol (IMAP)

In short, the Internet Message Access Protocol (IMAP) is the protocol that the incoming email servers use. It is a protocol that manages and retrieves email messages. Therefore, it can only receive messages but not send emails. 

Think back to the description of SMTP. This protocol delivers outgoing emails, via outgoing mail servers. It delivers to incoming mail servers based on the domain of the recipient’s email address. 

Once the email has found its way to the recipient’s server, it’s down to IMAP to retrieve emails and deliver them from IMAP servers to the recipients’ inboxes. 

In effect, when you log in to read your emails, IMAP retrieves your mail from your mail server and sends it to your client. 

Post Office Protocol (POP)

Another kind of mail server protocol concerned with arriving mail is POP – the Post Office Protocol. It fetches mail from mail servers and brings it to clients. The most common version used is POP3, or the Post Office Protocol version 3.

It may sound like POP moves email around mail servers similarly to IMAP, but there is one big difference. POP ensures that the email is deleted from outgoing mail servers once it has been delivered. 

In effect, POP allows you to download emails from your mail server to a single computer. It then deletes the email on the server. This is different from how IMAP works. It allows the mail server to sync with a number of different computer devices and stores your emails on the IMAP servers. 

A diagram comparing POP and IMAP servers.
POP vs. IMAP

What is a mail client? 

While mail servers are the hardware responsible for sending and receiving emails, email clients are the software

An email client is also notably not the same as mail server software. The latter processes incoming and outgoing mail for many users in mail servers. And it allows a system administrator to manage accounts. On the other hand, an email client simply sends, receives, and organizes mail for one specific user at a time. 

Clients tend to work slightly differently when receiving emails, depending on which protocol is in use. If POP is at work, the client downloads emails from the server to your local computer for you to access them. If SMTP or IMAP are at work, the client synchronizes with the mail server to allow you to access your mail directly. 

Ultimately, most email clients use SMTP to send emails. 

As the user-facing aspect of emails that connect users to servers and allow them to access their important emails, most folks on the internet tend to be familiar with email clients. If you’ve ever used Microsoft Outlook, Gmail, Apple Mail, Mozilla Thunderbird, iOS Mail, Outlook or Yahoo Mail, then you are familiar with at least one email client.

Envelopes around a computer representing the work of email clients.
Email client sending and receiving messages

Some clients, like Gmail or Outlook, are web-based, meaning you access them via a web browser, while others are standalone applications. Typically, users can add email accounts to any mail app so long as they can gather mail server information.

Conclusion

You should now understand why the email server is the backbone of all email communication on the internet. 

Armed only with an IP address, each email server can handle messages sent to and from email accounts all around the world. 

Whether you’re sending your emails from a smartphone, tablet, laptop or smart fridge, the one constant is the mail servers that route your message to its final destination. 


About the author

Ignas Anfalovas

Platform Engineering Manager

Ignas is a Platform Engineering Manager at IPXO with more than 7 years of experience in the IT sector. His expertise includes network design solutions and infrastructure maintenance. After working hours, you will find Ignas in Lithuanian folk-dance classes.