OBJECTIVES:
❑ To explain the architecture of electronic mail using four
scenarios.
❑ To explain the user agent (UA), services provided by it, and two
types of user agents.
❑ To explain the mechanism of sending and receiving e-mails.
❑ To introduce the role of a message transfer agent and Simple
Mail
❑ Transfer Protocol (SMTP) as the formal protocol that handles
MTA.
❑ To explain e-mail transfer phases.
❑ To discuss two message access agents (MAAs): POP and IMAP.
TCP/IP Protocol Suite 1
OBJECTIVES (continued):
❑ To discuss MIME as a set of software functions that transforms
non-ASCII data to ASCII data and vice versa.
❑ To discuss the idea of Web-based e-mail.
❑ To explain the security of the e-mail system.
TCP/IP Protocol Suite 2
❑ On October 29th 1969, the first message was sent from
computer to computer on ARPANET.
It looked like this:
An IMP log excerpt kept at UCLA (University of California, Los Angeles)
that describes setting up a message transmission from the UCLA SDS
Sigma 8 host computer to the SRI SDS 940 host computer. The initials
“CSK” to the right stand for Charles S Kline.
TCP/IP Protocol Suite 3
TCP/IP Protocol Suite 4
Ray Tomlinson
TCP/IP Protocol Suite 5
❑ By the 1980’s, the infancy of the internet, Internet Service
Providers (ISPs) had begun connecting people across the
world, and email “hosting” sites began to pop up,
clamouring for their piece of the pie.
❑ For many new internet users, electronic mail was the first
practical application of this exciting new medium.
❑ By 1993 the word “electronic mail” had been replaced by
“email” in the public lexicon and internet use had become
more widespread.
TCP/IP Protocol Suite 6
23-1 ARCHITECTURE
To explain the architecture of e-mail, we give four
scenarios. We begin with the simplest situation
and add complexity as we proceed. The fourth
scenario is the most common in the exchange of
e-mail.
TCP/IP Protocol Suite 7
Topics Discussed in the Section
✔ First Scenario
✔ Second Scenario
✔ Third Scenario
✔ Fourth Scenario
TCP/IP Protocol Suite 8
Figure 23.1 First scenario
TCP/IP Protocol Suite 9
In the first scenario, the sender and the receiver of the e-mail are users (or application
programs) on the same mail server; they are directly connected to a shared mail
server.
The administrator has created one mailbox for each user where the received messages
are stored. A mailbox is part of a local hard drive, a special file with permission
restrictions.
Only the owner of the mailbox has access to it. When Alice needs to send a message
to Bob, she runs a user agent (UA) program to prepare the message and store it in
Bob’s mailbox. The message has the sender and recipient mailbox addresses (names
of files). Bob can retrieve and read the contents of his mailbox at his convenience
using a user agent. Figure 23.1 shows the concept.
When the sender and the receiver of an e-mail are on the same mail server, we need
only two user agents.
TCP/IP Protocol Suite 10
Note
When the sender and the receiver of an
e-mail are on the same mail server,
we need only two user agents.
TCP/IP Protocol Suite 11
Figure 23.2 Second scenario
TCP/IP Protocol Suite 12
Figure 23.2 Second scenario
Alice needs to use a user agent program to send her message to the mail server at her own
site. The mail server at her site uses a queue (spool) to store messages waiting to be sent. Bob
also needs a user agent program to retrieve messages stored in the mailbox of the system at
his site.
The message, however, needs to be sent through the Internet from Alice’s site to Bob’s site.
Here two message transfer agents are needed: one client and one server. Like most
client-server programs on the Internet, the server needs to run all of the time because it does
not know when a client will ask for a connection.
The client, on the other hand, can be triggered by the system when there is a message in
the queue to be sent.
When the sender and the receiver of an e-mail are on different mail servers,
we need two UAs and a pair of MTAs (client and server).
TCP/IP Protocol Suite 13
Note
When the sender and the receiver of an
e-mail are on different mail servers,
we need two UAs and a pair of MTAs
(client and server).
TCP/IP Protocol Suite 14
Figure 23.3 Third scenario
TCP/IP Protocol Suite 15
Third scenario
Figure 23.3 shows the third scenario. Bob, as in the second scenario, is directly
connected to his mail server. Alice, however, is separated from her mail server.
Alice is either connected to the mail server via a point-to-point WAN—such as a
dial-up modem, a DSL, or a cable modem—or she is connected to a LAN in an
organization that uses one mail server for handling e-mails; all users need to send
their messages to this mail server.
Alice still needs a user agent to prepare her message. She then needs to send the
message through the LAN or WAN. This can be done through a pair of message
transfer agents (client and server). Whenever Alice has a message to send, she calls
the user agent which, in turn, calls the MTA client. The MTA client establishes a
connection with the MTA server on the system, which is running all the time. The
system at Alice’s site queues all messages received. It then uses an MTA client to
send the messages to the system at Bob’s site; the system receives the message and
stores it in Bob’s mailbox.
When the sender is connected to the mail server via a LAN or a WAN, we need two
Uas and two pairs of MTAs (client and server).
TCP/IP Protocol Suite 16
Note
When the sender is connected to the
mail server via a LAN or a WAN, we
need two UAs and two pairs of MTAs
(client and server).
TCP/IP Protocol Suite 17
Figure 23.2 fourth
In the fourth and most common scenario, Bob is also connected to his mail server by a
WAN or a LAN. After the message has arrived at Bob’s mail server, Bob needs to
retrieve it. Here, we need another set of client-server agents, which we call message
access agents (MAAs). Bob uses an MAA client to retrieve his messages. The client
sends a request to the MAA server, which is running all the time, and requests the
transfer of the messages. The situation is shown in Figure 23.4.
There are two important points we need to emphasize here. First, Bob cannot
bypass the mail server and use the MTA server directly. To use the MTA server
directly, Bob would need to run the MTA server all the time because he does not
know when a message will arrive. This implies that Bob must keep his computer on
all the time if he is connected to his system through a LAN. If he is connected
through a WAN, he must keep the connection up all the time. Neither of these situations
is feasible today.
Second, note that Bob needs another pair of client-server programs: message
access programs. This is because an MTA client-server program is a push program: the
client pushes the message to the server. Bob needs a pull program. The client needs to
pull the message from the server. Figure 23.5 shows the difference
TCP/IP Protocol Suite 18
Figure 23.4 Fourth scenario
TCP/IP Protocol Suite 19
SMTP (Simple Mail Transfer Protocol) is the primary Mail Transfer Agent
(MTA) protocol used for transferring (pushing) mails between end computers
and mail servers, Mail Access Agent (MAA) protocols like POP3/IMAP are
used for retrieving (pulling) incoming mails from the local mail servers.
Components of SMTP
Mail User Agent (MUA): It is a computer application that helps you in sending
and retrieving mail. It is responsible for creating email messages for transfer to
the mail transfer agent(MTA).
Mail Submission Agent (MSA): It is a computer program that receives mail
from a Mail User Agent(MUA) and interacts with the Mail Transfer
Agent(MTA) for the transfer of the mail.
Mail Transfer Agent (MTA): It is software that has the work to transfer mail
from one system to another with the help of SMTP.
Mail Delivery Agent (MDA): A mail Delivery agent or Local Delivery Agent is
basically a system that helps in the delivery of mail to the local system.
TCP/IP Protocol Suite 20
TCP/IP Protocol Suite 21
Note
When both sender and receiver are
connected to the mail server via a LAN
or a WAN, we need two UAs, two pairs of
MTAs (client and server), and a pair of
MAAs (client and server). This is the
most common situation today.
TCP/IP Protocol Suite 22
MUA (Mail User Agent)
Client application that allows receiving and sending emails.
It can be a desktop application such as Microsoft Outlook/Thunderbird/… or
web-based such as Gmail/Hotmail/… (the latter is also called Webmail).
TCP/IP Protocol Suite 23
MTA (Mail Transfer Agent)
■ Examples of MTAs are Postfix, Exim,
Sendmail, qmail
■ A server application that receives mail from the MSA(message submission
agent) (MTA).
■ It will find (through name servers and the DNS) the MX record from the
recipient domain's DNS zone in order to know how to transfer the mail.
■ It then transfers the mail (with SMTP) to another MTA (which is known as
SMTP relaying) or, if the recipient’s server has been reached, to the
MDA(message Delivery agent) (MTA).
TCP/IP Protocol Suite 24
Postfix, Exim, Sendmail, qmail
TCP/IP Protocol Suite 25
Postfix, Exim, Sendmail, qmail
■ Given the long history of email (dating back to 1971), and the massive number of
email servers online, you’d be right to assume that there are many different email
server platforms available. However, according to the securityspace.com survey,
three types of email servers account for more than 95% of the global market
share:
Exim
Postfix
Sendmail
■ The top three email servers on the internet are Exim (with over 55%), Postfix
(over 30%), and Sendmail (about 4%). All three of these email platforms, and
Qmail, were originally developed for Unix-Like or Linux based Operating Systems.
TCP/IP Protocol Suite 26
MTA
■ Mail Transfer Agent is an application that transfers information from one
PC to another using client–server application architecture. MTA
responsible for both the side client and server part of the SMTP (Simple
Mail Transfer Protocol).
■ A mail server is your personal PC that serves as an electronic post office
for email. Mail exchanged across networks is passed between email
servers that run a specially designed application. These application
programs are built around agreed-upon, standardized protocols for
managing information
TCP/IP Protocol Suite 27
Figure 23.5 Push versus pull
TCP/IP Protocol Suite 28
HELO client.net RCPT TO "user@recipient.net"
MAIL FROM "test@client.net" DATA
354 (server response code)
The NOOP command is used only Date: Wed, 30 July 2019 06:04:34
to check whether the server can From: test@client.net
respond. “250 OK” reply in Subject: How SMTP works
response To: user@recipient.net
Body text
.
TCP/IP Protocol Suite 29
TCP/IP Protocol Suite 30
Figure 23.10 Connection establishment
TCP/IP Protocol Suite 31
Figure 23.11 Message transfer
TCP/IP Protocol Suite 32
Figure 23.12 Connection termination
TCP/IP Protocol Suite 33
Example 23.1
Let us see how we can directly use SMTP to send an e-mail
and simulate the commands and responses we described
in this section. We use TELNET to log into port 25 (the
well-known port for SMTP). We then use the commands
directly to send an e-mail. In this example,
forouzanb@adelphia.net is sending an e-mail to himself.
The first few lines show TELNET trying to connect to the
adelphia mail server.
After connection, we can type the SMTP commands and
then receive the responses as shown below. We have
shown the commands in black and the responses in color.
Note that we have added for clarification some comment
lines, designated by the “=” sign. These lines are not part
of the e-mail procedure.
TCP/IP Protocol Suite 34
Example 19.1 Continued
TCP/IP Protocol Suite 35
TCP/IP Protocol Suite 36
TCP/IP Protocol Suite 37
23-4 MESSAGE ACCESS AGENT
The first and the second stages of mail delivery use SMTP.
However, SMTP is not involved in the third stage because SMTP is a push
protocol; it pushes the message from the client to the server.
In other words, the direction of the bulk data (messages) is from the client to
the server.
On the other hand, the third stage needs a pull protocol; the client must pull
messages from the server.
The direction of the bulk data are from the server to the client. The third stage
uses a message access agent.
TCP/IP Protocol Suite 38
TCP/IP Protocol Suite 39
TCP/IP Protocol Suite 40
TCP/IP Protocol Suite 41
TCP/IP Protocol Suite 42
TCP/IP Protocol Suite 43
Web-Based E-Mail
■ More and more users today are sending and accessing their e-mail
through their Web browsers. Hotmail introduced Web-based access
in the mid 1990s. Now Web-based e-mail is also provided by
Google, Yahoo!, as well as just about every major university and
corporation.
■ With this service, the user agent is an ordinary Web browser, and
the user communicates with its remote mailbox via HTTP. When a
recipient, such as Bob, wants to access a message in his mailbox,
the e-mail message is sent from Bob’s mail server to Bob’s browser
using the HTTP protocol rather than the POP3 or IMAP protocol.
■ When a sender, such as Alice, wants to send an e-mail message, the
e-mail message is sent from her browser to her mail server over
HTTP rather than over SMTP. Alice’s mail server, however, still
sends messages to, and receives messages from, other mail servers
using SMTP.
TCP/IP Protocol Suite 44
TCP/IP Protocol Suite 45
TCP/IP Protocol Suite 46
Topics Discussed in the Section
✔ POP3
✔ IMAP4
TCP/IP Protocol Suite 47
MAA protocols (POP3/IMAP) : The MAA protocols like POP3/IMAP are used in
the last hop of an email for retrieving incoming mails by the end user from
his/her local mail server. While both POP3 and IMAP are pull protocols, used
for retrieving mails from the local mail server to the receiving computer’s
Inbox, IMAP is a more powerful protocol than POP3.
IMAP supports additional features like creation and management of multiple
folders in the mail server, accessing mails from multiple end points etc.
Role of HTTP in email : Web based emails like yahoo, gmail use HTTP as the
underlying protocol for sending outgoing email messages from the end
computer to the local mail server and also for retrieving incoming mail
messages from the local mail server to the end computer.
However, HTTP is not used in the intermediate hops, for transferring emails
between mail servers. Only SMTP is used for transfer of mails between mail
servers.
TCP/IP Protocol Suite 48
POP3
■ This protocol mainly allows one protocol to be created on the
server.
■ As this protocol supports offline access to the messages and so
less internet usage time is required by this.
■ Non-email data is not accessed by this protocol.
■ Some of the common clients that make use of POP3 are Gmail,
Netscape, Internet Explorer, Eudora .
TCP/IP Protocol Suite 49
Working of POP
■ All the incoming messages are stored on the
POP server until the user login by using an
email client and downloads the message to
their computer. After the message is
downloaded by the user it gets deleted
from the server.
■ As we know that the SMTP is used to transfer
the email message from the server to the
server, basically POP is used to collect the
email with an email client from the server and
it does not include means to send messages.
TCP/IP Protocol Suite 50
TCP/IP Protocol Suite 51
POP3
■ If any user tries to check all the recent emails then they will establish a
connection with the POP3 at the server-side. The user sends the
username and password to the server machine for getting the proper
authentication. After getting the connection, users can receive all
text-based emails and store them on their local terminal (machine), then
finally discard all server copies and then breaks the connection
from the server machine.
■ In order to retrieve a message from the server following steps are
taken;
■ Firstly a TCP connection is established by the client using port 110.
■ The client identifies itself to the server.
■ After that client issues a series of POP3 commands.
TCP/IP Protocol Suite 52
POP3
TCP/IP Protocol Suite 53
Features of POP protocol
■ Given below are some of the features provided by the
POP protocol:
■ The POP protocol uses PORT 110.
■ It makes the use of a Persistent TCP connection.
■ It is a Pull protocol.
■ It is a connection-oriented protocol.
■ The POP protocol is a stateful protocol until the mail is
downloaded and across the sessions, it is a stateless
protocol.
TCP/IP Protocol Suite 54
Advantages of POP
■ Given below are the advantages offered by the POP :
■ This protocol does not require any internet connection in order to access
the downloaded emails.
■ In order to receive emails on a single device, POP3 is very useful.
■ The Configuration of this protocol is simple and it is easy to use.
■ Less storage space is needed in order to store emails on the hard disk.
■ This protocol is much better for the ones who hardly check their email
on any other computer.
TCP/IP Protocol Suite 55
Disadvantages of POP
■ The same email account cannot be accessed from
multiple computers or devices.
■ The spread of the virus is easily using this protocol
because it is possible that the file attached with the email
contains the virus.
■ The transfer of the local email folder to another email
client terminal point is a difficult task.
TCP/IP Protocol Suite 56
TCP/IP Protocol Suite 57
TCP/IP Protocol Suite 58
Figure 23.13 Pop3 and IMAP4
TCP/IP Protocol Suite 59
Figure 23.14 Pop3
TCP/IP Protocol Suite 60
23-5 MIME
• Electronic mail has a simple structure. Its simplicity, however, comes with a price.
• It can send messages only in NVT 7-bit ASCII format.
• The Network Virtual Terminal (NVT) ASCII character set, defined in RFC 854, is used for transferring files with a
Representation Type (TYPE) of ASCII. Characters in NVT-ASCII.
• Network Virtual Terminal (NVT) Character Set:
❑The Network Virtual Terminal (NVT) primarily employs two sets of characters: one for data and another
for control.
❑The NVT is an 8-bit character set for data, with the 7 lowest-order bits identical to ASCII and the highest
bit set to 0.
❑The NVT uses an 8-bit bit character set to communicate control characters between the computers, with
the highest-order bit set to 1.
❑For sending data and control characters the TELNET makes use of the same connection by just inserting
control characters into the data stream.
❑Each control character is preceded by the Special Control character, which is popularly known as Interpret
as Control, for separating the data characters from the control characters (IAC).
Multipurpose Internet Mail Extensions (MIME) is a supplementary protocol that allows non-ASCII data
to be sent through e-mail. MIME transforms non-ASCII data at the sender site to NVT ASCII data and
delivers it to the client MTA to be sent through the Internet. The message at the receiving site is
transformed back to the original data.
TCP/IP Protocol Suite 61
TCP/IP Protocol Suite 62
MIME is a short form of Multipurpose Internet Mail Extensions(MIME).
•It is mainly used to describe message content types.
•MIME is basically a supplementary protocol that mainly allows the
non-ASCII data to be sent through E-mail.
•It basically transforms the non-ASCII data at the sender site NVT ASCII
data and then delivers them to the client in order to be sent through the
Internet.
•At the receiver side, the message is transformed back to the original data.
•MIME is basically a set of software functions that mainly transforms the
Non-ASCII data to ASCII data and vice-versa,
•Following are the different kinds of data files that can be exchanged on the
Internet using MIME:
• audio
• images
• text
• video
• Other application-specific data(it can be pdf, Microsoft word
document, etc)
TCP/IP Protocol Suite 63
MIME is one of the applications of Email and it is not restricted only to the textual data .
TCP/IP Protocol Suite 64
Features of MIME
■ The features of the MIME protocol are as
follows:
1. MIME supports the character set other than
ASCII.
2. With the help of MIME, we can send multiple
attachments in a single message.
3. MIME also provides support for different
content types and multi-part messages.
4. It provides support of compound documents
5. It also provides support for non-textual content
in the email message.
TCP/IP Protocol Suite 65
Topics Discussed in the Section
✔ MIME Headers
TCP/IP Protocol Suite 66
Figure 23.15 MIME
TCP/IP Protocol Suite 67
Figure 23.16 MIME header
TCP/IP Protocol Suite 68
TCP/IP Protocol Suite 69
TCP/IP Protocol Suite 70
Figure 23.17 Base64
TCP/IP Protocol Suite 71
TCP/IP Protocol Suite 72
Figure 23.18 Quoted printable
TCP/IP Protocol Suite 73
Quoted-Printable is another method for
encoding binary data into a format that is
safe for transmission via email or other
text-based protocols. It is particularly used
for encoding email messages with
non-ASCII characters or binary attachments.
TCP/IP Protocol Suite 74
In Quoted-Printable encoding:
1.ASCII characters: Most printable ASCII characters (those with byte values between 33
and 126) are left unchanged. This includes letters, numbers, punctuation, and some
special characters.
2.Non-ASCII characters: Any character outside the range of printable ASCII characters is
encoded as an equal sign '=' followed by two hexadecimal digits representing the byte
value of the character. For example, the character 'é' might be represented as '=E9'.
3.Line breaks: Quoted-Printable also handles line breaks. Lines longer than a certain limit
(typically 76 or 78 characters) are split into multiple lines, and each line is terminated
with an equals sign '='. This indicates that the line break is not a true end-of-line but
rather a continuation of the current line. These line breaks are not counted as characters
when determining line length.
4.Soft line breaks: A soft line break can occur before a space or tab character if
necessary to avoid breaking a word in the middle. It consists of an equal sign '=' at the
end of the line, followed by a newline character. When decoding, this sequence indicates
that the line break is not significant and should be ignored.
TCP/IP Protocol Suite 75
23-6 WEB-BASED MAIL
E-mail is such a common application that some
websites today provide this service to anyone
who accesses the site. Three common sites are
Hotmail, Yahoo, and Google. The idea is very
simple. Let us go through two cases:
TCP/IP Protocol Suite 76
Topics Discussed in the Section
✔ Case I
✔ Case II
TCP/IP Protocol Suite 77
Figure 23.19 Web-based e-mail, case 1
TCP/IP Protocol Suite 78
Figure 23.20 Web-based e-mail, case 2
TCP/IP Protocol Suite 79
23-6 E-MAIL SECURITY
The protocol discussed in this chapter does not
provide any security provisions per se. However,
e-mail exchanges can be secured using two
application-layer securities designed in
particular for e-mail systems. Two of these
protocols, Pretty Good Privacy (PGP) and Secure
MIME (SMIME) are discussed in Chapter 30 after
we have discussed the basic network security.
TCP/IP Protocol Suite 80