Networking Tutorials

How Email Works Step by Step Explained

This tutorial explains how email works step by step in detail with examples including essential components of mail system such as UA, MSA, MTA, MDA and AA. Learn fundamentals and basic concepts of mail system along with how email travels from source to destination.

Essential components of mail system

In order to learn how email system works or how email travels from source to destination, we have to understand following essential components.

Email Client or Mail User Agent (UA)

An email client or user agent is a software or program which is used to compose and read the email. At sender side, it is used to compose and send the email. At receiver side, it is used to read and reply the received email. MS Outlook, MacOS Mail, /bin/mail, Alpine and Gmail are some examples of email client.

Mail Submission Agent (MSA)

MSA takes mail from user agent and deliver them to a mail transfer agent. MSA was developed later in email system. It was invented to reduce some burden from MTA.

If implemented, MSA sits between user agent and mail transfer agent. It secures connection between UA and MTA by implementing encryption and authentication. Besides this, it can perform a lot more tasks based on its configuration such as rewriting mail header and performing security checks.

Mail Delivery Agent (MDA)

MDA takes mail from MTA and deliver them to the message store. MDA does opposite of MSA. Just like MSA, it was also invented to reduce the burden from MTA. Since MDA deliver emails to local system, it is also known as LDA (local delivery agent). Same as MSA, several additional functionalities such as virus scanning and spam mail filtering can be configured in MDA.

MSA and MDA are the part of MTA. Whether they will be used or not depend several factors such as volume of emails and security requirement. But if they are configured in MTA, we have to configure the user agent to communication with them instead of MTA.

msa mta mda

Mail Transport agent (MTA)

MTA is the backbone of email system. It takes email from UA or MSA, understand recipient’s address and deliver it to its destination. MTA uses Simple Mail Transport Protocol (SMTP) for its operation.

Essential MTA operations are listed below.

Outgoing mail operation

  • Receive outgoing mail from UA and MSA
  • Understand recipient’s addresses
  • If require, rewrite addresses
  • Perform a DNS MX lookup to resolve the recipient’s address
  • If recipient is directly accessible, forward mail to MDA
  • If recipient is not directly accessible, forward mail to next responsible MTA

Incoming mail operation

  • Receive incoming mail from other MTA
  • Understand recipient’s addresses
  • If recipient belongs to it, perform virus scan and forward mail to MDA
  • If recipient does not belong to it, forward mail to next responsible MTA

Message stores

Message store is the location of recipient’s server or computer where messages are delivered by MDA. Depending on the setting, messages can be stored in several formats such mbox and Maildir.

The mbox format

In this format, all messages are stored in a single file. To separate messages from each other, a special form line is used.

The Maildir format

In this format, each message is stored in a separate file. This method is more convenient but it creates a lot of files.

Maildir or mbox format is convenient, if volume of mail is small. These methods are usually used in small office network or home network. In large network more advance method such as database is used to store the messages.

Access Agent (AA)

Access agent takes messages from message store and delivers them to email client or user agent in local device such as PC, laptop, tablet, smartphone, etc. Two protocols known as POP3 and IMAP are used by access agent to retrieve mail from message store.


POP3 is a one way protocol. It can only download messages in email client from message store. It does not tell message box what users do with downloaded messages. Since message store does not know what users do with downloaded messages, it keeps locally stored messages as they are or simply delete them once they are downloaded.


IMAP is a two way protocol. Besides downloading messages from message store, it also updates message store about the action which user performs with downloaded messages. Since message store knows the action which user takes on downloaded messages, it automatically performs that action on locally stored messages to keep the exact copy of messages at both locations.

This protocol uses advance techniques to download messages in email client from message store. It only downloads the header of mail. It downloads contents and attachments of mail only when user reads the mail.

Difference between POP3 and IMAP

A user uses his laptop and smartphone to check mail. He downloaded all emails from message store in laptop. After downloading, he filtered and deleted unnecessary emails. If user is using POP3, he has to perform same filtration in message store and in smartphone again to keep the exact copy of emails in all locations. But if he is using IMAP, there is no need to repeat the same actions again in message store and in smartphone. IMAP will automatically sync user’s action across all devices.

Following figure shows IMAP and POP3 settings in Gmail.

imap and pop example

How email works

A user wants to send an email to several recipients, so he accesses an email client program and adds recipients in To, CC and BCC fields. He composes the email and click Send button.

Based on configuration, email client sends email to either MSA or MTA for further processing. If MSA is configured, email will be forwarded to it. If MSA is not configured, email will be forwarded to MTA directly.

If MSA is configured and mail is received, it rewrites the header and performs several essential checks based on its configuration. Once all defined checks are done, it forwards mail to MTA.

If MSA is not configured and mail is directly received, MTA performs all MSA’s tasks and checks the recipient’s addresses. If recipients are more than one, it makes a separate copy of email from original email for each recipient.

MTA performs a DNS lookup to figure out the recipient’s address. If recipient address is resolved, MTA packs email in envelop and forwards it to the MTA which is authorized to receive recipient’s mail.

At recipient’s MTA, if MDA is configured, received email will be forwarded to it. Based on configuration, MDA performs several security checks such as virus scanning and spam filtering. If MDA is not configured, MTA will perform all MDA’s tasks. Once pre-delivery checks are done, email is forwarded to message store.

Email remains in message store until it is downloaded by email client program. Once email is downloaded it will be available in inbox of recipient.

how email works step by step example

Parts of email

An email contains three separate parts; envelope, header and body.


An email is wrapped in an envelope by first MTA. First MTA puts all necessary information such as delivery address, return address and failure address in envelope. Other MTAs use this information to forward or deliver the mail. An envelope determines where the email will be delivered or to whom it will be returned if it can’t be delivered.

Envelopes are internally used by MTAs to exchange mail between them. An envelope wrapped by first MTA is unwrapped by last MTA. An end user never sends and receives envelope with mail. Envelopes are invisible to users.


Header keeps record of all information about email such as from which address it was sent, the date and time when it was sent, by which MTA it was received and forwarded and when it was delivered at destination. Email clients usually hide header from user while displaying email contents.


Body contains the message text and attachments. Originally mail was developed for text messages. Over the time, it became so popular that a new standard known as MIME was developed to support several other formatting and encoding features.

MIME (Multipurpose Internet Mail Extensions) allows us to format and encode email text with more advance formatting technique such as HTML. Since MIME uses its own methods for formatting and encoding the mail text and attachment, email client doesn’t need to be running on same platform or using same operating system. Nearly all modern email clients support and use MIME standards.

That’s all for this tutorial. If you have any feedback, suggestion or comment about this tutorial, please mail me. If you like this tutorial, please share it friends through your favorite social network.

Prerequisites for 200-301

200-301 is a single exam, consisting of about 120 questions. It covers a wide range of topics, such as routing and switching, security, wireless networking, and even some programming concepts. As with other Cisco certifications, you can take it at any of the Pearson VUE certification centers.

The recommended training program that can be taken at a Cisco academy is called Implementing and Administering Cisco Solutions (CCNA). The successful completion of a training course will get you a training badge.

Full Version 200-301 Dumps

Try 200-301 Dumps Demo