Home » Computer Network » Explain how e-mail reaches its destination. Explain in brief SMTP, emphasizing the role and function of the User Agent (UA) and Mail Transfer Agent (MTA)..

Explain how e-mail reaches its destination. Explain in brief SMTP, emphasizing the role and function of the User Agent (UA) and Mail Transfer Agent (MTA)..

Last updated:

Support this post with a reaction:

5,536 views

E-mail (Electronic Mail) is an Internet-based communication service that allows users to exchange messages and digital files such as documents, images, audio, and videos. It provides a fast, convenient, and cost-effective way to communicate with people across different locations.

When a user sends an e-mail, the message does not directly travel from the sender’s computer to the recipient’s computer. Instead, it passes through several components of the e-mail system, including the User Agent (UA), Mail Transfer Agent (MTA), and destination mail server.

The User Agent (UA) helps users create, send, receive, and manage e-mail messages. The Mail Transfer Agent (MTA) is responsible for transferring messages between mail servers. These components mainly use Simple Mail Transfer Protocol (SMTP) to send and deliver e-mails over the Internet.

How Does E-mail Reach Its Destination?

E-mail delivery involves a series of steps that allow a message to travel from the sender’s device to the recipient’s mailbox. Each step performs a specific function to ensure that the message reaches the correct destination.

For example, consider a situation where Alice wants to send an e-mail to Bob. The following steps explain how the message travels through the e-mail system.

Steps Involved in E-mail Delivery

1. Composing the E-mail

The first step is to create an e-mail message using an e-mail application or web-based service such as Gmail, Microsoft Outlook, or Thunderbird.

The sender enters the recipient’s e-mail address, subject, and message content. The sender can also attach files such as documents, photographs, and other digital content.

The software used to compose and manage the e-mail is called the User Agent (UA). It provides a user-friendly interface through which the sender interacts with the e-mail system.

Example:

2. Submitting the E-mail to the Sender’s Mail Server

After composing the message, Alice clicks the Send button. The User Agent then submits the message to the sender’s outgoing mail server.

This process is commonly performed using SMTP. The outgoing mail server receives the message and prepares it for further delivery.

Before accepting the message, the server may authenticate the sender to verify that the user is authorized to send e-mails through that account.

For example, when Alice sends an e-mail through Gmail, the Gmail application or website submits the message to Google’s mail infrastructure.

3. Processing the Message by the Mail Transfer Agent (MTA)

After receiving the message, the Mail Transfer Agent (MTA) processes it to determine where the e-mail should be delivered.

The MTA examines the recipient’s e-mail address and identifies the domain name. For example, in bob@example.com, example.com is the recipient’s domain.

The MTA then determines which mail server is responsible for receiving messages for that domain. It generally uses the Domain Name System (DNS) to find the destination mail server.

This step helps the sending server identify the correct server to which the message must be transferred.

4. Finding the Destination Mail Server Using DNS

The Domain Name System (DNS) helps locate the mail server responsible for receiving e-mails for a particular domain.

The sending MTA performs a DNS lookup to find the Mail Exchange (MX) record associated with the recipient’s domain.

An MX record specifies the mail server responsible for accepting e-mails for that domain. If multiple MX records exist, their priority values help determine which server should be tried first.

For example, when Alice sends an e-mail to bob@example.com, the sending MTA checks the MX records for example.com to identify its receiving mail server.

After finding the destination server, the sending MTA establishes a connection with it.

5. Transferring the E-mail Using SMTP

Once the destination mail server is identified, the sending MTA establishes an SMTP connection with the receiving MTA.

SMTP is used to transfer the e-mail message from one mail server to another. During this process, the sending server provides the sender’s address, recipient’s address, and message content.

The receiving server responds to SMTP commands with status codes indicating whether the requested operations are successful or unsuccessful.

If the receiving server accepts the message, it takes responsibility for further delivery within its mail system.

6. Receiving and Storing the E-mail

After accepting the message, the recipient’s mail server processes it and places it in the appropriate mailbox.

The receiving mail system may perform additional activities, such as spam filtering, malware scanning, and checking message policies.

Once these checks are completed, the message becomes available in the recipient’s mailbox.

For example, Bob’s mail server stores Alice’s message in Bob’s inbox so that he can access it later.

7. Retrieving and Reading the E-mail

The final step is retrieving the message from the recipient’s mailbox.

Bob opens his e-mail application or webmail service to access the received message. Protocols such as IMAP (Internet Message Access Protocol) and POP3 (Post Office Protocol version 3) are commonly used for accessing e-mails stored on a mail server.

IMAP allows users to access and synchronize messages across multiple devices, while POP3 generally downloads messages to the user’s device.

Bob can now open and read the e-mail sent by Alice.

What is User Agent (UA)?

A User Agent (UA) is an application or software program that provides an interface between the user and the e-mail system. It allows users to create, send, receive, read, reply to, forward, and organize e-mail messages.

The User Agent makes e-mail communication easier by providing different options for managing messages without requiring users to understand the technical details of e-mail transmission.

A User Agent is also commonly known as an e-mail client or mail user agent (MUA).

For example, when a user opens Gmail, Outlook, or Thunderbird to compose or read an e-mail, the application acts as a User Agent.

Functions of User Agent (UA)

1. Composing E-mail Messages

The User Agent provides an interface for creating new e-mail messages. Users can enter the recipient’s e-mail address, subject, and message content before sending the message.

It also provides text-formatting options, such as bold, italic, font size, and alignment, depending on the application.

2. Sending E-mail Messages

After the user clicks the Send button, the User Agent submits the message to the outgoing mail server. SMTP is commonly used for this submission process.

The User Agent prepares the message with the required information so that the mail server can process it and begin delivery.

3. Receiving E-mail Messages

The User Agent allows users to access incoming messages stored in their mailboxes. It communicates with the mail server using protocols such as IMAP or POP3.

This function helps users receive and read messages sent by other people.

4. Managing E-mail Messages

The User Agent provides different options to organize and manage e-mail messages. Users can create folders, move messages, mark messages as important, delete unwanted messages, and search for specific e-mails.

These features help users manage large numbers of messages efficiently.

5. Attaching Files

The User Agent allows users to attach files such as PDF documents, images, spreadsheets, presentations, and other supported file types to e-mail messages.

MIME (Multipurpose Internet Mail Extensions) helps represent attachments and other non-plain-text content in a format that can be transferred through e-mail systems.

6. Replying and Forwarding Messages

The User Agent allows users to reply to received messages or forward them to other recipients.

The reply option helps continue an existing conversation, while forwarding allows users to share an existing message with another person.

7. Address Book Management

Most User Agents provide an address book or contact list to store frequently used e-mail addresses and contact details.

This feature reduces the need to enter complete e-mail addresses every time a user sends a message and helps avoid typing mistakes.

Examples of User Agents

  • Gmail: A web-based e-mail service that allows users to send, receive, and manage e-mail messages.
  • Microsoft Outlook: An e-mail application used to manage messages, contacts, calendars, and other communication activities.
  • Mozilla Thunderbird: A desktop e-mail client that supports sending, receiving, and organizing e-mail messages.
  • Apple Mail: An e-mail application available on Apple devices for managing different e-mail accounts.

What is Mail Transfer Agent (MTA)?

A Mail Transfer Agent (MTA) is software responsible for receiving, routing, and transferring e-mail messages from one mail server to another.

It works in the background as an important part of the e-mail delivery system. When a User Agent submits an outgoing message, the MTA processes the message and determines the appropriate destination mail server.

MTAs mainly use Simple Mail Transfer Protocol (SMTP) to communicate with other mail servers and transfer e-mail messages across the Internet.

For example, when Alice sends an e-mail to Bob, the sending MTA identifies Bob’s mail server and transfers the message to that server using SMTP.

Functions of Mail Transfer Agent (MTA)

1. Receiving E-mail Messages

The MTA receives outgoing messages submitted by User Agents and messages transferred from other mail servers.

After receiving a message, it processes the necessary information to determine how the message should be delivered.

2. Identifying the Destination Address

The MTA examines the recipient’s e-mail address to identify the destination domain.

For example, in bob@example.com, the domain name is example.com. The MTA uses this information to determine which mail server should receive the message.

3. Performing DNS Lookup

The MTA uses the Domain Name System (DNS) to locate the destination mail server.

It checks the MX records of the recipient’s domain to identify the mail server responsible for accepting incoming e-mails.

This process helps the MTA route messages to the correct destination.

4. Transferring E-mail Messages

After identifying the destination mail server, the sending MTA establishes an SMTP connection with the receiving mail server.

It transfers the message using SMTP commands and waits for responses from the receiving server.

If the receiving server accepts the message, the transfer process is completed successfully.

5. Message Queuing and Retry

Sometimes, the destination mail server may be temporarily unavailable because of network problems, server maintenance, or other technical issues.

In such situations, the MTA stores the message in a temporary queue and attempts to deliver it again after some time.

This mechanism helps prevent temporary connection problems from immediately causing message loss.

6. Handling Delivery Errors

The MTA handles different types of delivery failures during message transmission.

For example, if the recipient’s address does not exist or the receiving server permanently rejects the message, the sending mail system may generate a delivery failure notification, also known as a bounce message.

This notification informs the sender that the message could not be delivered.

7. Communicating with Other Mail Servers

The MTA communicates with other mail servers through SMTP. It follows the SMTP commands and responses to establish connections, transfer messages, and complete delivery operations.

This function makes it possible to exchange e-mails between users who use different e-mail services.

Examples of Mail Transfer Agents

  • Postfix: An open-source MTA commonly used on Linux and Unix-based systems.
  • Sendmail: A traditional MTA used for routing and delivering e-mail messages.
  • Exim: An MTA widely used on Unix-like operating systems.
  • Microsoft Exchange: A mail and collaboration server platform that includes message transport functionality.

What is SMTP (Simple Mail Transfer Protocol)?

SMTP (Simple Mail Transfer Protocol) is a standard application-layer protocol used to send and transfer e-mail messages over the Internet.

It defines how e-mail clients submit outgoing messages to mail servers and how mail servers communicate with one another to transfer messages to their destinations.

SMTP follows a client-server communication model. The sending system acts as an SMTP client, while the receiving system acts as an SMTP server during a mail transfer session.

SMTP mainly handles the sending and transfer of e-mail messages. It does not normally provide the functions required to retrieve messages from a recipient’s mailbox. Protocols such as IMAP and POP3 are used for accessing received messages.

Functions of SMTP

1. Sending E-mail Messages

SMTP allows users to send e-mail messages from their e-mail applications to outgoing mail servers.

When a user clicks the Send button, the e-mail application submits the message to the mail server using SMTP.

2. Transferring Messages Between Mail Servers

SMTP enables different mail servers to communicate with each other and transfer e-mail messages over the Internet.

For example, an e-mail sent from a Gmail account to an Outlook account can be transferred between the respective mail systems using SMTP.

3. Identifying Sender and Recipient

SMTP uses specific commands to identify the sender and recipient during message transfer.

The MAIL FROM command specifies the envelope sender address, while the RCPT TO command specifies the envelope recipient address.

These commands help the receiving mail server identify where the message comes from and where it needs to be delivered.

4. Transferring Message Content

SMTP transfers the actual e-mail content after the sender and recipient information has been accepted.

The message may contain headers, a text body, and MIME-formatted content such as attachments, images, and HTML content.

5. Providing Delivery Responses

SMTP uses numerical response codes to indicate the result of different operations.

For example, a response beginning with 250 generally indicates successful completion of a requested operation, while responses beginning with 4 indicate temporary failures and responses beginning with 5 indicate permanent failures.

These responses help the sending system decide whether to continue, retry, or stop the delivery process.

Common SMTP Commands

SMTP uses a set of commands to establish a connection and transfer e-mail messages between servers.

SMTP CommandFunction
HELOIntroduces the sending system to the SMTP server.
EHLOIntroduces the sending system and requests supported SMTP extensions.
MAIL FROMSpecifies the sender’s envelope e-mail address.
RCPT TOSpecifies the recipient’s envelope e-mail address.
DATABegins the transfer of the message content.
QUITEnds the SMTP session.

Common SMTP Port Numbers

SMTP uses different port numbers for message submission and transfer.

  • Port 25: Commonly used for transferring e-mails between mail servers.
  • Port 587: Commonly used for authenticated e-mail submission from clients to mail servers, generally with STARTTLS.
  • Port 465: Commonly used for e-mail submission with implicit TLS encryption.

Working of SMTP in E-mail Delivery

SMTP follows a sequence of commands and responses to transfer an e-mail message from the sender to the recipient’s mail server.

Consider the example of Alice sending an e-mail to Bob.

Step 1: Establishing a Connection

The sending mail server establishes a TCP connection with the destination mail server, usually on port 25 for server-to-server SMTP transfer.

The receiving SMTP server sends a greeting message to indicate that it is ready to communicate.

Step 2: Introducing the Sending Server

The sending server introduces itself using the EHLO command. The receiving server responds with the SMTP extensions and capabilities it supports.

Step 3: Identifying the Sender

The sending server uses the MAIL FROM command to specify the sender’s envelope address.

Example:

MAIL FROM:<alice@gmail.com>

Step 4: Identifying the Recipient

The sending server uses the RCPT TO command to specify the recipient’s address.

Example:

RCPT TO:<bob@example.com>

Step 5: Transferring the Message

The sending server uses the DATA command to begin transferring the message content.

The message includes its headers, such as From, To, and Subject, followed by the body.

A single period on a line by itself indicates the end of the message data in the SMTP transaction.

Step 6: Accepting the Message

If the receiving server successfully accepts the message, it sends a positive SMTP response, commonly 250 OK.

The receiving server then takes responsibility for delivering the message to Bob’s mailbox.

Step 7: Closing the Connection

After completing the transfer, the sending server uses the QUIT command to end the SMTP session.

Difference Between User Agent (UA) and Mail Transfer Agent (MTA)

User Agent (UA)Mail Transfer Agent (MTA)
It is an application that provides an interface between the user and the e-mail system.It is software responsible for transferring e-mails between mail servers.
It directly interacts with the user.It works mainly in the background.
It allows users to compose, send, receive, and manage e-mails.It receives, routes, and delivers e-mail messages.
It provides options for attaching files, replying, forwarding, and organizing messages.It performs DNS lookups, message queuing, routing, and server-to-server transfer.
It submits outgoing messages to a mail server.It transfers messages to the destination mail server.
Examples include Gmail, Outlook, and Thunderbird.Examples include Postfix, Sendmail, and Exim.

Difference Between SMTP and IMAP/POP3

SMTPIMAPPOP3
Used to send and transfer e-mails.Used to access and manage e-mails stored on a mail server.Used to retrieve and download e-mails from a mail server.
Mainly handles outgoing messages.Mainly handles incoming messages.Mainly handles incoming messages.
Commonly uses ports 25, 587, and 465.Commonly uses ports 143 and 993.Commonly uses ports 110 and 995.
Used by mail clients and mail servers for message submission and transfer.Helps synchronize messages across multiple devices.Often downloads messages to a local device.

Complete Example of E-mail Delivery

Consider Alice, who uses Gmail, and Bob, who uses an e-mail service hosted at example.com.

Alice wants to send an e-mail containing meeting details to Bob. The complete process takes place as follows:

  1. Alice opens Gmail and composes a message using the User Agent (UA).
  2. She enters Bob’s e-mail address, subject, and message content.
  3. After clicking Send, Gmail submits the message to its outgoing mail server using SMTP.
  4. The sender’s Mail Transfer Agent (MTA) processes the message and examines Bob’s e-mail address.
  5. The sending MTA performs a DNS lookup to find the MX record for example.com.
  6. After identifying the destination mail server, the sending MTA establishes an SMTP connection with it.
  7. The message is transferred to the receiving mail server using SMTP commands.
  8. The receiving mail server accepts the message and stores it in Bob’s mailbox.
  9. Bob opens his e-mail application and accesses the message using IMAP or POP3.
  10. Finally, Bob reads the meeting details sent by Alice.

Conclusion

E-mail delivery is a process that involves multiple components working together to transfer messages from the sender to the recipient. The User Agent (UA) provides an interface for composing, sending, receiving, and managing e-mails, whereas the Mail Transfer Agent (MTA) is responsible for routing and transferring messages between mail servers.

SMTP plays an important role in this process by providing a standard method for submitting and transferring e-mail messages across the Internet. DNS helps identify the destination mail server, while IMAP and POP3 allow recipients to access their received messages.

Therefore, the User Agent, Mail Transfer Agent, SMTP, DNS, and e-mail access protocols work together to make e-mail communication possible.