0% found this document useful (0 votes)
38 views109 pages

SMTP

The document discusses the architecture of email including four scenarios of increasing complexity. The first involves a sender and receiver on the same mail server using only two user agents. The second involves different mail servers requiring two UAs and an MTA client-server pair. The third adds a LAN/WAN connection for the sender requiring two additional MTAs. The fourth and most common scenario adds the receiver connecting via LAN/WAN using an MAA client-server pair to retrieve messages.

Uploaded by

ssohan.is21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views109 pages

SMTP

The document discusses the architecture of email including four scenarios of increasing complexity. The first involves a sender and receiver on the same mail server using only two user agents. The second involves different mail servers requiring two UAs and an MTA client-server pair. The third adds a LAN/WAN connection for the sender requiring two additional MTAs. The fourth and most common scenario adds the receiver connecting via LAN/WAN using an MAA client-server pair to retrieve messages.

Uploaded by

ssohan.is21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 109

Electronic Mail:

SMTP(Simple mail transfer


protocol), POP(Post Office Protocol,)
IMAP(Internet Message Access
Protocol), and MIME(Multipurpose
Internet Mail Extensions)
1
■ Smtp 25
■ POP 110 WITHOUT SSL
■ IMAP 143 WITHOUT SSL

■ IMAP SSL (IMAPS) - port 993


■ POP 110 WITH SSL port 995

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.
3
4
Ray Tomlinson

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.

6
7
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.

8
9
10
■ MTA :A mail/message transfer agent (MTA) is a
software that transfers emails between the computers
of a sender and a recipient.
■ MSA:A message submission agent (MSA), or mail
submission agent, is a computer program or software
agent that receives electronic mail messages from a
mail user agent (MUA) and cooperates with a mail
transfer agent (MTA) for delivery of the mail.
■ MUA: A mail client application used by an end user to access a
mail server to read, compose, and send email messages.
Common MUAs include Microsoft Outlook and Mozilla
Thunderbird.

11
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).

12
MTA (Mail Transfer Agent)

■ Examples of MTAs are Postfix, Exim,


Sendmail, qmail

13
Postfix, Exim, Sendmail,
qmail

14
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.

15
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

16
MAA
■ Message Access Agent: POP and IMAP. 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 ...

17
Figure 23.5 Push versus pull

18
Topics Discussed in the Section
✔ First Scenario
✔ Second Scenario
✔ Third Scenario
✔ Fourth Scenario

19
Figure 23.1 First scenario

20
21
Figure 23.1 First scenario

22
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.

23
Note

When the sender and the receiver of an


e-mail are on the same mail server,
we need only two user agents.

24
Figure 23.2 Second scenario

25
26
Figure 23.2 Second scenario

27
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 waitingto be sent. Bob
also needs a user agent program to retrieve messages stored in the mailboxof 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).

28
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 29


30
31
Figure 23.3 Third scenario

32
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).
33
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).

34
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

35
36
Fourth scenario

37
Figure 23.4 Fourth scenario

38
While 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.

39
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.

40
41
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.

42
23-2 USER AGENT

The first component of an electronic mail system is the


user agent (UA). It provides service to the user to
make the process of sending and receiving a message
easier.

43
Topics Discussed in the Section
✔ Services Provided by a User Agent
✔ User Agent Types
✔ Sending Mail
✔ Receiving Mail
✔ Addresses
✔ Mailing List or Group List

44
Note

Some examples of command-driven


user agents are mail, pine, and elm.

45
Pine

46
Elm Email Client

47
Note

Some examples of GUI-based user


agents are Eudora, Outlook,
And Netscape.

48
Eudora

49
50
Figure 23.6 Format of an email

51
52
Figure 23.7 E-mail address

53
23-3 MESSAGE TRANSFER AGENT
The actual mail transfer is done through message transfer agents
(MTAs). To send mail, a system must have the client MTA, and
to receive mail, a system must have a server MTA.
The formal protocol that defines the MTA client and server in
the Internet is called Simple Mail Transfer Protocol (SMTP).
As we said before, two pairs of MTA client-server
programs are used in the most common situation
(fourth scenario). Figure 23.8 shows the range of the
SMTP protocol in this scenario.

54
Figure 23.8 SMTP range

55
56
Figure 23.9 Commands and responses

57
NOOP : NO OPERATION
Smol from: It send mail to the
terminal if possible; otherwise to
mailbox.
SMAL : It send mail to the terminal
and mailbox.

58
59
Figure 23.10 Connection establishment

60
Figure 23.11 Message transfer

61
Figure 23.12 Connection termination

62
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, [email protected] 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.

63
Example 19.1 Continued

64
65
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.

66
TCP/IP Protocol Suite 67
68
69
70
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.

71
72
73
Topics Discussed in the Section
✔ POP3
✔ IMAP4

74
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.

75
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 .

76
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.
77
78
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.

79
POP3

80
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.

81
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.

82
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.

83
84
85
Figure 23.13 Pop3 and IMAP4

86
Figure 23.14 Pop3

87
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. The NVT-ASCII
character set contains a subset of the standard ASCII
character set defined in ANSI standard X3. In other
words, it has some limitations.

88
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.

89
90
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.

91
MIME is one of the applications of Email and it is not restricted only to the textual data .

92
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)
93
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.
94
Topics Discussed in the Section
✔ MIME Headers

95
Figure 23.15 MIME

96
Figure 23.16 MIME header

97
98
99
Figure 23.17 Base64

100
101
Figure 23.18 Quoted printable

TCP/IP Protocol Suite 102


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.

103
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.

104
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:

105
Topics Discussed in the Section
✔ Case I
✔ Case II

TCP/IP Protocol Suite 106


Figure 23.19 Web-based e-mail, case 1

107
Figure 23.20 Web-based e-mail, case 2

108
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.

109

You might also like