Electronic mail has changed and developed over time. Statistics show that nearly 2,840,000 emails are sent every single second (InternetLiveStats.com). Our world revolves around this service that connects us.
One thing most people don’t understand is how email works, or more importantly, where it actually resides. This is knowledge that you will need in the future, so best to learn it now. How exactly does email work?
It’s actually pretty cool.
Note: Some of the things covered here, you may or may not be familiar with, but they will be covered in more detail in follow-up articles.
How email works
First, a mail user agent converts a message into text. Once converted, the mail user agent uses DNS to connect to the configured mail transport agent via the Simple Mail Transfer Protocol (SMTP). The sending mail agent then performs a mail exchanger record (MX record) lookup of the destination, connects to the destination mail transport agent, and finally delivers the email.
When delivery happens, the destination mail transport agent reviews the email and sends an acknowledgment that the message was received. The email is then delivered either to a virtual user or handled with a specific action (bounced, discarded, etc.)
For every email that is sent, a log entry is created in the mail client. Going over the basics of mail servers and its components is important to system administration. In this article, I’ll start with the basics and cover what you might need to know before configuring mail servers on Red Hat Enterprise Linux (RHEL)-based environments.
Email service components
As I mentioned earlier, there are three components of email services: mail user agents, mail transport agents, and mail delivery agents. Each component has its own purpose and a core reason for making email work in general.
I'll go over what happens when an email is sent once again, but this time in more detail.
Mail user agents
A mail user agent is essentially an email client. It helps the user to read the mail they receive and to write the email they want to send out. The mail user agent also actively receives and sends the email itself.
Mail transport agents
A mail transport agent is essentially an email service on a server. It is responsible for making sure that the mail is delivered from location to location. When you send an email, the mail server (often referred to as the SMTP server) processes the mail through the EHLO
/HELO
, which is a command it sends to identify itself when trying to connect to another mail server via SMTP. Once the receiving mail server is able to identify the destination mail server, SMTP relays the email to the destination server.
There are other parts of the SMTP process that are important to identify as well. Once the connection is made, commands are sent to the destination server in order for the email to be accessible by the mail user agent:
- The
MAIL FROM
command identifies the original sender of the email. - The
RCPT TO
command gives the recipient’s address. - The
DATA
command starts the process of sending the message body to the destination. - A dot by itself on a separate line stops the message.
- The
QUIT
command closes the SMTP session and finalizes the process.
Mail delivery agents
A mail delivery agent is essentially an agent that delivers email on a local machine. There are two main protocols when mail user agents send email: the latest version of the Post Office Protocol (POP3) and the Internet Message Access Protocol (IMAP).
POP3 allows you to download copies of your email to your personal computer. These copies are usually unchanged, but it is common to unintentionally configure POP3 to delete the server copies after downloading the local copies. POP3 is best for those who prefer to have a backup of their email and don’t need to spend a lot of time online, but still need to read messages.
On the other hand, IMAP allows you to read email as it appears on the server. IMAP is best for those who have a lot of different people connecting from different sources, or an email account user who prefers to have their messages on a server rather than on their local machine.
Each protocol has its own ports that are usually available by default for your mail client. For POP3, the ports are 110 (default) and 995 (secure). For IMAP, they’re 143 (default) and 993 (secure).
Now that you're more familiar with the components and what they do, you can move on to the good stuff. System administrators live within their terminal, and this article covers configuring mail as such. In my past as a system administrator, setting up, configuring, and managing mail servers has been a helpful skill-set to have. I had a hard time remembering the services and what to install, so I used acronyms to remember commands, files, etc.
Learning mail services can be beneficial, whether in a work environment or a personal one. If you are ready to get started with installing an email server, I encourage you to read how to install and configure Postfix and how to install and configure Dovecot.
About the author
I currently work as a Cloud Support Supervisor for Acronis . I have worked with Linux and OpenSource tools for a decade, constantly wanting to make new resolutions for obstacles and always training others on improving systems as a systems administrator. I’ve helped manage and maintain elaborate servers and websites over the years. In my spare time, I enjoy spending time with my dogs, reading, and playing video games.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit