A mail server sends and receives email messages using outgoing and incoming email protocols.
After reading this article you will be able to:
Related Content
Subscribe to theNET, Cloudflare's monthly recap of the Internet's most popular insights!
Copy article link
A mail server (sometimes called an email server) is a software program that sends and receives email. Often, it is used as a blanket term for both mail transfer agents (MTA) and mail delivery agents (MDA), each of which perform a slightly different function.
Mail servers play a crucial role in the email delivery process. Without them, users would have no way of transferring those messages to and from other mail clients.
Mail servers send messages from one mail client to another. A mail client (also called an *email client* or *message user agent*) is a web-based or desktop application that receives and stores email messages. Some of the most widely-used mail clients include Microsoft Outlook, Gmail, and Apple Mail.
Email messages are sent and received using two types of mail servers: outgoing mail servers, or *mail transfer agents* (MTA), and incoming mail servers, or *mail delivery agents* (MDA). MTAs retrieve outgoing email messages from the sender’s mail client, then deliver them to MDAs, which are responsible for temporarily storing and delivering email messages to the recipient’s mail client.
Mail servers deliver email messages between mail clients by using email protocols, which tell the server how to process incoming requests, where to forward the messages, and how to deliver them to the intended mail client.
When sending an email from one client to another, the MTA uses an outgoing mail protocol, like the Simple Mail Transfer Protocol (SMTP), to check the sender’s email envelope* data and determine where the message needs to be sent. SMTP does this by using the Domain Name System (DNS) to translate the recipient’s domain into an IP address.
Then, it locates a mail delivery agent by querying mail exchange (MX) records. The MX record tells the server how to route the message to its final destination. Once the MX record returns the appropriate destination, the MDA uses an incoming mail protocol, like the Internet Message Access Protocol (IMAP) or Post Office Protocol Version 3 (POP3), to retrieve the email message from the mail server and deliver it to the specified mail client (or clients).
For an in-depth explanation of the email delivery process, see What is email?
*An email envelope contains the sender and recipient’s email addresses, among other data SMTP needs in order to transfer an email message from server to server.
While mail clients and mail servers are both used to send and receive email messages, they are not the same. A mail client is an application that allows users to retrieve, store, and format emails to be sent. Mail servers, meanwhile, are software programs that use email protocols to move email messages between mail clients.
To illustrate this difference, imagine that Alice wants to send Carol a letter. Alice addresses the letter to Carol, then leaves it in their mailbox. A postal worker retrieves the letter from the mailbox and delivers it to a post office, where it is sorted and transferred to the correct location. Finally, another postal worker delivers the letter to Carol’s mailbox, where it can be stored until they are ready to retrieve it.
Similarly, a user may write and address an email to its intended recipient (or recipients), but the mail server, like the postal worker, is responsible for accepting the message, transferring it to an incoming mail server, then delivering it to the correct inbox, where it is stored.
Most email providers offer mail client services to their users. While email providers rely on mail servers to exchange messages between clients, they do not always make mail servers available to users as a free or paid service.
For example, consider two popular email providers: Google and Apple. As of 2023, Google offers both a mail client (Gmail) and mail server (Gmail SMTP Server). Gmail allows users to store, retrieve, and send emails, while Gmail SMTP Server gives users access to a wider range of features, like sending email messages from third-party clients (e.g. Microsoft Outlook). Apple, on the other hand, only provides a mail client called Apple Mail.
Because any type of message can be sent over email, attackers often use it to send phishing messages, malware, or other dangerous content. Most mail servers do little to prevent attacks like this, aside from ensuring that emails came from the location that they claim to be from (via DKIM, DMARC, and SPF).
To solve for this security gap, some email providers scan emails for suspicious elements, filter spam, and implement encryption to prevent attackers from accessing and manipulating messages.
Cloudflare Area 1 is a cloud-based email security solution that preemptively blocks phishing attempts, quarantines fraudulent communications, and blocks campaigns across a wide range of attack vectors. Learn more about Area 1.