Skip to main content

CompTIA A+View full course outline

Mail Servers(OBJ.2.3)

By Jonathon Eades — Founder & IT InstructorUpdated

8 min read

Short answer

A mail server is a system that sends, receives, stores, and routes email across networks. SMTP sends mail (ports 25, 587, 465), while POP3 (110, 995) downloads it to one device and IMAP (143, 993) keeps it on the server and syncs devices. DNS MX records tell senders which servers handle a domain's mail.

A mail server is a system that sends, receives, stores, and routes email messages across networks. Mail servers act as digital post offices, handling the transmission of messages between users whether they're on the same network or across the globe. Organizations run their own mail servers for internal communication and security control, while many businesses now rely on cloud-hosted email services like Microsoft 365 or Google Workspace.

A complete email infrastructure typically involves multiple server roles working together: sending outbound mail, receiving inbound mail, and providing mailbox access to end users.

Email Protocols

Email relies on several protocols, each serving a specific function in the message lifecycle.

Diagram: an email's path. 1 Submission from the sender's email client to the sender's mail server over SMTP: port 587 with STARTTLS or 465 with implicit TLS. 2 Relay from the sender's mail server to the recipient's mail server over SMTP port 25. 3 Retrieval from the recipient's mail server to the recipient's devices: IMAP on 143, or 993 (IMAPS), or POP3 on 110, or 995 (POP3S). SMTP only sends; POP3 and IMAP only retrieve. POP3 usually downloads and deletes; IMAP keeps mail on the server and syncs every device.
SMTP sends on 587, 465 or 25; IMAP and POP3 retrieve on 143/993 and 110/995.

Protocol Comparison

Comparison table of POP3 and IMAP across five features: message storage, where POP3 downloads locally and IMAP keeps mail on the server; multi-device access, poor for POP3 and excellent for IMAP; server storage required, minimal versus more; offline access, full for downloaded mail versus limited without sync; and bandwidth usage, higher initial download versus lower because IMAP syncs headers first.

SMTP (Simple Mail Transfer Protocol) handles sending and relaying mail. Your email client uses SMTP to submit outgoing messages, and mail servers use it to relay messages to each other. Port 25 is the traditional server-to-server relay port, while port 587 is the standard client submission port with STARTTLS encryption (port 465 for implicit SSL/TLS). SMTP only sends—it never retrieves mail.

POP3 (Post Office Protocol version 3) retrieves mail by downloading messages to a single device, typically deleting them from the server afterward (unless "leave a copy on server" is enabled). It uses port 110, or port 995 for the SSL/TLS-encrypted version (POP3S). POP3 suits single-device users but provides no synchronization across devices.

IMAP (Internet Message Access Protocol) keeps messages on the server and synchronizes mailbox state—read status, folders, deletions—across every connected device. It uses port 143, or port 993 for the encrypted version (IMAPS). IMAP is the standard choice for users who check mail from multiple devices.

Protocol Summary Table

ProtocolRolePortSecure PortMailbox Behavior
SMTPSending and server-to-server relay25 (relay), 587 (submission)465 (SSL/TLS), 587 (STARTTLS)Outbound only; does not store or retrieve mail
POP3Retrieving mail to one device110995 (POP3S)Downloads messages, usually deletes them from the server
IMAPRetrieving and syncing mail143993 (IMAPS)Messages stay on the server; state syncs across all devices

Mail Server Components

Enterprise mail systems consist of several components working together.

MTA (Mail Transfer Agent)

The MTA routes messages between servers using SMTP. When you send an email to someone at another domain, your MTA looks up the recipient's mail server and delivers the message. Popular MTAs include Microsoft Exchange, Postfix, and Sendmail.

MDA (Mail Delivery Agent)

The MDA receives mail from the MTA and places it in the correct user mailbox. It handles local delivery and mailbox storage.

MUA (Mail User Agent)

The MUA is the email client that users interact with—applications like Microsoft Outlook, Mozilla Thunderbird, Apple Mail, or webmail interfaces. The MUA retrieves mail via POP3 or IMAP and sends mail via SMTP.

Message Flow Example

Diagram: one email's trip from example.com to example.net. 1 The user writes it in Outlook (MUA); 2 Outlook submits it over SMTP on TCP 587 with STARTTLS to its mail server; 3 that MTA asks DNS for example.net's MX records (MX 10 mail1, MX 20 mail2); 4 it relays the message over SMTP on TCP 25 to mail1.example.net; 5 the MDA puts it in the mailbox; 6 the recipient's mail app retrieves it over IMAP (993, or 143 unencrypted). POP3 (110/995) downloads mail to one device.
One message's trip: SMTP 587 to the sender's server, an MX lookup, SMTP 25 relay, MDA delivery, IMAP 993.
  1. User composes email in Outlook (MUA)
  2. Outlook sends message via SMTP to organization's mail server
  3. The MTA queries DNS for the recipient's MX record
  4. MTA relays message to recipient's mail server via SMTP
  5. Recipient's MDA delivers message to the mailbox
  6. Recipient's MUA retrieves message via IMAP

DNS Records for Email

Mail servers rely on specific DNS records to function properly.

MX Records

MX (Mail Exchange) records specify which servers handle email for a domain. Each MX record includes a priority value; lower numbers indicate higher priority. If the primary server is unavailable, mail routes to the next priority server.

Example MX records for example.com:

Priority 10: mail1.example.com
Priority 20: mail2.example.com

Mail servers attempt delivery to mail1 first. If it's unreachable, they try mail2.

Other Important Records

A/AAAA Records: Map mail server hostnames to IP addresses

PTR Records: Reverse DNS lookup; many mail servers reject messages from IPs without valid PTR records

SPF Records: Specify which servers are authorized to send mail for the domain

DKIM Records: Contain public keys for verifying email signatures

DMARC Records: Define policies for handling messages that fail SPF or DKIM checks

Email Security

Email is a primary target for attacks. Understanding security measures helps protect users and organizations.

Authentication Protocols

SPF (Sender Policy Framework) publishes a DNS TXT record listing authorized sending servers.

This lesson is part of ExamWizardz Pro

Unlock every lesson, unlimited practice tests, and the AI tutor.

See Pro pricing

or start with a free account

Test yourself on this topic: free Network Services and Servers practice questions — no account needed.

Key terms in this lesson