Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
40 views35 pages

Email Protocols: SMTP, POP3, IMAP

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)
40 views35 pages

Email Protocols: SMTP, POP3, IMAP

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/ 35

Electronic Mail

SMTP,POP3 &IMAP
Electronic M a il
• Electronic mail (or e-mail) allows users to exchange messages.
• In a n application such a s HTTP or FTP, the server program is running all the
time, waiting for a request from a client.

• Whe n the request arrives, the server provides the service. There is a request
a nd there is a response.
• In the case of electronic mail, response is not mandatory. E-mail is
considered a one-way transaction. If there is a response, it is another one- way
transaction.

•It is neither feasible nor logical for someone to run a server program and
wait until the sender sends a n e-mail to them.

• This m ea ns that the idea of client/server programming should be


implemented in another way: using some intermediate computers (servers). The
users run only client programs when they want
Architecture
ARCHITECTURE

First Scenario
The sender and the receiver of the e-mail are users (or application programs)
on the s a m e mail server; they are directly connected to a shared mail server.
The administrator has created one mailbox for e a c h user where the received
messages are stored.
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).
When the sender and the receiver of an e-mail are on the same mail server, we
need only two user agents.
S e co n d Scenario
The sender and the receiver of the e-mail are users on two different mail servers.
The message needs to be sent over the Internet. Here we need user agents (UA)
and message transfer agents (MTAs).
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 needs to be sent through the Internet from Alice’s site to Bob’s site.
The server needs to run all of the time, the client can be triggered by the system
when there is a message in the queue to be sent.
Third Scenario
Bob, as in the second scenario, is directly connected to his mail server. Alice is
either connected to the mail server via a point-to-point WAN or she is
connected to a LAN in an organization that uses one mail server for handling
e-mails.
Alice uses a user agent to prepare her message and sends the message
through the LAN or WAN. This c a n 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 and sends the messages to Bob’s site.
The received messages are stored 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).
Fourth Scenario
In the common scenario, the sender and the receiver of the e-mail are
c onnec ted via a LAN or a W AN to two m a il servers.
We use three different agents in a mail transfer: a user agent (UA), a message
transfer agent (MTA), and a message access agent (MAA).
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.
There are two important points we need to emphasize.
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.
Second, 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.
Who’s this UA?
User A gent
A user agent is a software package (program) that composes, reads, replies to,
and forwards messages.
There are two types of user agents: command-driven and GUI-based.
A command-driven user agent normally accepts a one character command
from the keyboard to perform its task. For example, a user c a n type the
character r, at the command prompt, to reply to the sender of the message, or
type the character R to reply to the sender and all recipients.
They contain graphical user interface (GUI) components that allow the user to
interact with the software by using both the keyboard and the mouse.
They have graphical components such as icons, menu bars, and windows that
make the services easy to access.
Sending mail
The message contains the header and the body. The header of the message
defines the sender, the receiver, the subject of the message, and some other
information. The body of the message contains the actual information to be
read by the recipient.

Receiving mail
If a user has mail, the UA informs the user with a notice. If the user is ready to
read the mail, a list is displayed in which e a ch line contains a summary of the
information about a particular message in the mailbox.
The summary usually includes the sender mail address, the subject, and the
time the mail was sent or received.
Addresses
The address consists of two parts: a local part and a domain name, separated
by an @ sign.
The local part defines the n a m e of a special file, called the user mailbox, where
all the mail received for a user is stored for retrieval by the message access
agent. The second part of the address is the domain name.

Mailing list or Group List


Electronic mail allows one name, an alias, to represent several different e-mail
addresses; this is called a mailing list. Every time a message is to be sent, the
system checks the recipient’s n a m e against the alias database; if there is a
mailing list for the defined alias, separate messages, one for e a c h entry in the
list, m ust be prepa red a nd ha nded to the MTA.
Mail Transfer Agent
MAIL TRANSFER AGENT: SMTP

Based on the common scenario, we refer to the first and the second as Message
Transfer Agents (MTAs), the third as Message Access Agent (MAA).
The formal protocol that defines the MTA client and server in the Internet is
called Simple Mail Transfer Protocol (SMTP). SMTP is used two times, between the
sender and the sender’s mail server and between the two mail servers. SMTP
simply defines how commands and responses must be sent back and forth.
How Does It Work?
Commands and Responses
SMTP uses commands and responses to transfer messages between an MTA client and
an MTA server.
The command is from an MTA client to an MTA server; the response is from an MTA serv
to the MTA client.
Each command or reply is terminated by a two-character end-of-line token.

Commands
MAIL TRANSFER PHASES
CONNECTION ESTABLISH
The SMTP server starts the connection phase after a client has made a TCP connection to the
port 25.

STEPS:
The server sends code 220 (service ready).
If the server is not ready, it sends code 421.
The client sends the HELO message to identify itself, using its domain name address.
The server responds with code 250 or some other code depending on the situation.
MESSAGE TRANSFER
• After connection has been established between the SMTP client and server,
a single message between a sender and one or more recipients can be exchanged.
• STEPS:
• The client sends the MAIL FROM message (for returning errors and messages) which includes the
mail address of the sender.
• The server responds with code 250 or some other appropriate code. The
client sends the RCPT TO messa ge.
• The server responds with code 250 or some other appropriate code. The
client sends the DATA message to initialize the message transfer.
• The server responds with code 354 or some other appropriate message.
• The client sends the contents of the message in consecutive lines. Each line is terminated by a two
character end-of-line token (carriage return and line feed). The message is terminated by a line
containing just one period.
• The server responds with code 250 (OK) or some other appropriate code.
CONNECTION TERMINATION
After the message is transferred successfully, the client terminates the connection.

STEPS:
The c lient sends the QUIT c om m and.
The server responds with code 221 or some other appropriate code.
EX A MP L E
To show the three mail transfer phases, we show all of the steps
described a b o v e using the information depicted in Figure 26.16.
In the figure, we h a v e separated the m e s s a g e s related to the
envelope, header, a n d body in the d a ta transfer section. Note
that the steps in this figure are repeated two times in e a c h e-
mail transfer: once from the e-mail sender to the local mail
server a n d once from the local mail server to the remote mail
server. The local mail server, after receiving the whole e-mail
message, m a y spool it a n d send it to the remote mail server at
another time.
Message Access Agent
MESSAGE ACCESS AGENT

The first a n d second stages of mail delivery use SMTP.


SMTP is a push protocol.
The third stage needs a pull protocol.
It uses a m e s s a g e a c c e s s agent.
Two m e s s a g e a c c e s s protocols are available:
P OP3-Post O f fice Protocol, v ersion 3
IMAP4 - In ternet Ma il Ac c e ss Protocol, v ersion 4
POP3
POP3
The client POP3 software is installed
on the recipient computer; the
server POP3 software is installed on
the mail server.
Mail a c c e s s starts with the client
when the user needs to download its
e-mail from the mailbox on the mail
server.
The client opens a connection to the
server on TCP port 110.
It then sends its user n a m e a n d
password to a c c e s s the mailbox.
The user c a n then list a n d retrieve
the mail messages, one by one.
There are two modes:
1. De le te
2.Keep
In the delete mode, the mail is deleted from the mailbox after e a c h retrieval.
In the keep mode, the mail remains in the mailbox after retrieval.
The delete mode is normally used when the user is working at her permanent
computer a n d c a n save a n d organize the received mail after reading or
replying.
The keep mode is normally used when the user a c c e s s e s her mail a w a y from
her primary computer.
The mail is read but kept in the system for later retrieval a nd organizing.
IMAP
❑ A user can check the e-mail header prior to downloading.

❑ A user can search the contents of the e-mail for a specific string of characters prior

to downloading.

❑ A user can partially download e-mail. This is especially useful if bandwidth is lim- ited and the e-mail contains multimedia with
high bandwidth requirements.

❑ A user can create, delete, or rename mailboxes on the mail server.

❑ A user can create a hierarchy of mailboxes in a folder for e-mail storage.


IMAP4
More features and more powerful and complex than POP3.
POP3 does not allow the user to organize her mail on the server and also
doesn't allow the partial check of contents before downloading.

Functions:
A user c a n check the e-mail header prior to downloading.
A user c a n search the contents of the e-mail for a specific string of
characters prior to downloading.
A user c a n partially download e-mail. This is especially useful if bandwidth is
limited and the e-mail contains multimedia with high bandwidth
requirements.
A user c a n create, delete, or rename mailboxes on the mail server.
A user c a n create a hierarchy of mailboxes in a folder for e-mail storage.

You might also like