TechKnowSurge
CompTIA Network+ 1.4 CompTIA A+ Core 1 2.4 Cisco CCST Networking 1.5 Cisco CCNA 4.3 CompTIA A+ Core 1 2.1 CompTIA Network+ 4.1 CompTIA SecurityX 2.4 Cisco CCST Cybersecurity 2.1
VideoNetworkFree

Email Protocols

Email delivery depends on a coordinated set of protocols and DNS records working together to route messages from sender to recipient. This content covers SMTP, POP3, IMAP, webmail access, and SPF records, along with the DNS infrastructure that makes email routing possible.

Complete this video to capture a CTF flag worth 1 point.

About this video

Email delivery relies on a structured chain of components, each with a defined role in moving a message from one user to another. The process begins with the mail user agent, the client application used to compose and send email. That message is passed to a mail submission agent, then handed off to a mail transfer agent, which performs a DNS lookup for the destination domain's MX record to identify the correct mail exchanger. The mail exchanger accepts the message on behalf of that domain and delivers it to a mail delivery agent, where it waits until the recipient retrieves it. Depending on the size of an organization, some of these roles may be combined on a single server or distributed across multiple systems. SMTP, operating on TCP port 25, is the protocol responsible for pushing email between servers at each stage of this chain, with SMTPS being the encrypted and preferred variant. Once a message reaches the mail delivery agent, end users retrieve it using either POP3 or IMAP. POP3 pulls messages down to the local client and typically removes them from the server, while IMAP maintains a continuous sync between the client and server, preserving folder structures and ensuring that any device accessing the mailbox — including through a web browser via webmail over HTTPS — sees a consistent, up-to-date view of the inbox. SPF, or Sender Policy Framework, adds sender authentication to the email delivery process. When a mail exchanger receives a message, it can query the sending domain's DNS records for an SPF entry that lists the servers authorized to send mail on that domain's behalf. If the sending server's IP address or hostname matches the SPF record, the message is more likely to be accepted as legitimate. If it does not match, the receiving server may route the message to a spam folder or flag it for review, though outright rejection is not always the default behavior. Together, DNS, SMTP, POP3, IMAP, webmail, and SPF form the foundational infrastructure that enables reliable and verifiable email communication.

What you'll learn

What's covered

Email Protocols Overview

Aligned to

CompTIA Network+
1.4 Explain common networking ports, protocols, services, and traffic types.
4.1 Explain the importance of basic network security concepts.
CompTIA A+ Core 1
2.4 Summarize services provided by networked hosts.
2.1 Compare and contrast Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) ports, protocols, and their purposes.
Cisco CCST Networking
1.5 Describe common network applications and protocols.
Cisco CCNA
4.3 Explain the role of DHCP and DNS within the network.
CompTIA SecurityX
2.4 Given a scenario, implement appropriate controls to secure communications and collaboration solutions.
Cisco CCST Cybersecurity
2.1 Describe TCP/IP protocol vulnerabilities.

Key terms

Domain Name System
DNS
A hierarchical naming system that translates human-readable domain names into IP addresses.
Port
A logical endpoint for communication in a network, identified by a number that specifies a particular service or application.
Mail Exchanger (DNS record)
MX
A DNS record type that specifies the hostname of the mail server responsible for accepting email messages on behalf of a domain. MX records include a priority value so that multiple mail servers can be configured with failover preference.
Mail User Agent
MUA
The client application used by an end user to compose, send, and receive email messages.
Mail Submission Agent
MSA
A server component that receives outgoing email from a mail user agent and forwards it to a mail transfer agent for delivery.
Mail Transfer Agent
MTA
A server component responsible for routing and relaying email messages between servers by performing DNS MX record lookups to determine the destination.
Mail Delivery Agent
MDA
A server component that receives email from a mail transfer agent and stores it in the recipient's mailbox until retrieved.
Simple Mail Transfer Protocol
SMTP
A TCP-based application-layer protocol used to send email messages between mail servers and from mail clients to outbound mail servers, typically on port 25 (server-to-server) or port 587 with TLS (client submission). SMTP only handles sending mail; retrieval is handled by separate protocols such as IMAP or POP3.
Post Office Protocol version 3
POP3
A TCP-based email retrieval protocol that downloads messages from a mail server to a local client, operating on port 110 (insecure) or port 995 (over SSL/TLS).
Internet Message Access Protocol
IMAP
A TCP-based email protocol that provides dynamic synchronization between a mail server and client, operating on port 143 (insecure) or port 993 (over SSL/TLS).
Sender Policy Framework
SPF
Sender Policy Framework is an email authentication protocol that allows domain owners to specify which mail servers are authorized to send email on their behalf, helping receiving servers identify and reject spoofed messages.

Transcript

Email and DNS

Here's an example of an email address: example at technosurge.com. What it knows is that this is a user that it's trying to access, and this is the domain that that user is supposedly a part of. What it needs to know is what server out there will be answering, or will be receiving, mail for technosurge.com.

So it has to do a DNS lookup and ask for an MX record — it needs to know the MX record for technosurge.com. It will go through the domain name system, through that process of looking up who belongs to technosurge.com, and ask for the MX record. It will receive that MX record, and now it knows where I need to send this email off to. Then when it gets to the other side, that mailbox server is going to look at that user and determine what user it needs to go to.

Mail delivery at a high level

Let's take a high level look at how this mail gets transferred. We have two users here, and this user wants to send mail to this user right here. Both of these are the mail user agent, or the MUA. We're going to be sending from this MUA to this MUA.

What it needs to do is, this MUA has a connection to, or knows of, the mail submission agent it needs to send mail to. A mail submission agent is where you submit mail into, so this MSA, or mail submission agent, accepts mail.

From there it's going to transfer it to a mail transfer agent. The mail transfer agent is designed to get it to its destination, where it needs to go. This is the machine that actually does the lookup and tries to figure out what the MX record is for the domain that you're sending it to. So it looks it up, determines what the server is that it needs to go to, and then relays that email to it.

This is what's called a mail exchanger. The mail exchanger is what accepts mail on behalf of a domain. So in this case, this mail exchanger is accepting mail on behalf of the domain that this user is a part of. It accepts that and then transfers it to a mail delivery agent, where it's going to reside until this mail user agent gets on and pulls that email down — does a retrieval process and pulls that information down. So that is the flow that happens throughout here.

Some of this can be combined into one server. What I mean by that is this mail submission agent and the mail transmission agent could be one server, or it could be multiple servers. Sometimes it depends on the size of the organization, and that depends on how much they split these individual roles out and get them separated out. But essentially those are the components that are needed to get mail from one location to another.

SMTP

How do we move this mail around? One way is through SMTP, or simple mail transfer protocol. Simple mail transfer protocol operates on TCP port 25.

SMTP is a way for one device to transfer mail to another device, so think of it more as a push. It's a push of mail from one device to the next. In this diagram, when we were looking at it, we said that the mail user agent pushed that email to the mail submission agent, which pushed it to the mail transfer agent, which pushed it to the mail exchanger, which pushed it to the mail delivery agent. All of those use SMTP or SMTPS for transferring that data. We usually like to use SMTPS, but there are still some servers out there that use SMTP, and a lot of servers will still accept mail through SMTP. That is where SMTP is used: to push that mail along from device to device until it gets to the mail delivery agent.

POP3 and IMAP

So then we're asked the question: how do we get it to the end user? How do we get it to the mail user agent? To do that, it's more of a poll or a sync, depending on what protocol you're talking about.

POP version 3 is a way for this user agent to reach out to the server and say, "Do you have an email for me?" and then it pulls it down to the client. Think of it as the client actively going and grabbing the information and pulling it down. Because of that, we don't have a copy now on the mail delivery agent. There is a way to say, "Hey, leave a copy on the agent." But where I'm going with this is that POP version 3 is a great way to retrieve mail, but it has definite limitations. That's where we're going to get into our next protocol.

IMAP is more of a sync between the mail delivery agent and the mail user agent. It syncs back and forth. What I mean by this is that the mail user agent establishes a connection to the mail delivery agent, and they're constantly contacting back and forth seeing if there are any updates. If I'm sending data, then it will make that connection and send the data; or if I'm receiving data, it will make that connection and receive the data. Think of it as a much more dynamic, open connection between the two.

The advantages of this are things like: I can create folders and move data around from folder to folder. If I were to do that when I was using POP version 3, I would move it into a folder, but it wouldn't appear that way on the mail delivery agent — it would just keep it where it was, in the same inbox. Versus if I do that on the mail user agent that uses IMAP, then it will sync the two up, so that it moves the mail on the mail delivery agent as well, into a folder. So it's a way to create a more dynamic connection.

Webmail

One reason why we would want the mail delivery agent to always be updated is because we also access webmail. If the user is accessing, or has a client, and is making that connection, and all of that information is getting updated on the server, then if I go to my mobile device, or if I go to a web browser, or other devices that are connecting in, everything is going to be updated, and so everything is going to have the most updated information.

Webmail is one of those examples. I could get onto my mailbox and be able to see my inbox and see the folders within it, accessed through webmail. So webmail is another way of accessing those resources, and webmail is accessed through HTTPS. I can use it through a web browser and access the mail. That is what webmail is.

SPF records

The SPF record is to make sure that whatever mail transfer agent is sending the mail is supposed to be sending that mail. Let me give you an example. Let's say this mail transfer agent is sending to the mailbox exchanger, and it's sending mail that's something atample.com — so it's sending mail on behalf of example.com. This mailbox exchanger really doesn't know the validity of this server right here. So what it will do is go and look up the SPF record that exists in the example.com domain. We'll do the DNS lookup, look at example.com, look at the SPF record and say, what are your servers that should be sending mail? Then it will take a look and see if the IP address, or if the name, of this server should be sending that mail or not. If it is acceptable, if it is on the SPF record, it's more likely to accept that mail and less likely to label it as junk mail.

There are a couple of things that we can actually do when it gets that information, when it realizes this came from a server that's in or not in the SPF record. It can handle it many different ways, and we can actually specify how it handles it. For instance, if it receives mail from a server that's not supposed to send mail for that domain, then what it could do is put that in the junk folder, or label it as possible spam, or it can treat that message differently. A lot of times we don't just automatically assume that it's wrong, because there's a lot of mail that's being sent from a lot of different servers out there. So a lot of times we don't automatically assume that that is bad mail, but it labels it as more likely that it is bad mail.

That's what an SPF record does essentially. An SPF record is a check to see whether whatever server is sending the mail is the server that should be sending the mail from that domain — is it representing that domain?

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →