Simple Mail
Transfer Protocol (SMTP)
·
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).
·
Following fig. Shows the scenario of SMTP protocol.
·
SMTP
is used two times, between the sender and the sender’s mail server and
between the two mail servers.
·
Commands
and Responses
·
SMTP
uses commands and responses to transfer messages between an MTA client and
an
MTA server as shown in following fig.
·
Each
command or reply is terminated by a two-character end-of-line token.
·
Commands
·
Commands
are sent from the client to the server. The format of a command is shown below:
·
Keyword:
argument(s)
·
It
consists of a keyword followed by zero or more arguments. SMTP defines 14
commands
listed in following Table and described in more detail below.
·
HELO.
This command is
used by the client to identify itself. The argument is the
domain
name of the client host. The format is HELO: challenger.atc.fhda.edu
·
MAIL
FROM. This
command is used by the client to identify the sender of the
message.
The argument is the e-mail address of the sender (local part plus the
domain
name). The format isMAIL FROM: forouzan@challenger.atc.fhda.edu
·
RCPT
TO. This
command is used by the client to identify the intended recipient of
the
message. The argument is the e-mail address of the recipient. If there are
multiple
recipients,
the command is repeated. The format isRCPT TO: betsy@mcgraw-hill.com
·
DATA.
This command is
used to send the actual message. All lines that follow the
DATA
command are treated as the mail message. The message is terminated by a
line containing just
one period. The format isDATA
This is the
message
to
be sent to the McGraw-Hill
Company.
·
QUIT.
This command
terminates the message. The format is QUIT
·
RSET.
This command
aborts the current mail transaction. The stored information
about
the sender and recipient is deleted. The connection will be reset. RSET
·
VRFY.
This command is
used to verify the address of the recipient, which is sent
as
the argument. The sender can ask the receiver to confirm that a name identifies
a
valid
recipient. Its format isVRFY: betsy@mcgraw-hill.com
·
NOOP.
This command is
used by the client to check the status of the recipient. It
requires
an answer from the recipient. Its format isNOOP
·
TURN.
This
command lets the sender and the recipient switch positions, whereby
the
sender becomes the recipient and vice versa. However, most SMTP implementations
today
do not support this feature. The format isTURN
·
EXPN.
This command
asks the receiving host to expand the mailing list sent as the
arguments
and to return the mailbox addresses of the recipients that comprise the
list.
The format isEXPN: x y z
·
HELP.
This command
asks the recipient to send information about the command
sent
as the argument. The format isHELP: mail
·
SEND
FROM. This
command specifies that the mail is to be delivered to the
terminal
of the recipient, and not the mailbox. If the recipient is not logged in,
the
mail is bounced back. The argument is the address of the sender. The
format
isSEND FROM: forouzan@fhda.atc.edu
·
SMOL
FROM. This
command specifies that the mail is to be delivered to the terminal
or
the mailbox of the recipient. This means that if the recipient is logged in,
the mail is delivered only to the terminal. If the
recipient is not logged in, the mail is
delivered
to the mailbox. The argument is the address of the sender. The format is
·
SMAL
FROM. This
command specifies that the mail is to be delivered to the terminal
and
the mailbox of the recipient. This means that if the recipient is logged in,
the mail is
delivered to the terminal and the mailbox. If the recipient is not logged
in, the mail is delivered only
to the mailbox. The argument is the address of the
sender.
The format is SMAL FROM: forouzan@fhda.atc.edu
·
Responses
Responses are sent from the
server to the client. A response is a three-digit code that
may be followed by additional
textual information.
Following
Table lists some of the responses.
·
Mail
Transfer Phases
·
The
process of transferring a mail message occurs in three phases: connection
establishment,mail transfer, and connection termination.
i)
Connection Establishment
After a client has made a TCP connection to the well-known
port 25, the SMTP server
starts the connection phase. This phase involves the
following three steps, which are
illustrated in
Fig.
1. The server sends code 220 (service ready) to tell the client
that it is ready to receive
mail. If the server is not ready, it sends code 421 (service
not available).
2. The client sends the HELO message to identify itself using
its domain name
address. This step is necessary to inform the server of the domain
name of the
client. Remember that during TCP connection establishment,
the sender and
receiver know each other through their IP addresses.
3. The server responds with code 250 (request command
completed) or some other
code depending on
the situation.
i)
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. This phase
involves eight steps. Steps 3 and 4 are repeated if there is
more than one recipient (see
in Fig.).
1. The client sends the MAIL FROM message to introduce the
sender of the message.
It includes the mail address of the sender (mailbox and the
domain name). This
step is needed to give the server the return mail address
for returning errors and
reporting messages.
2. The server responds with code 250 or some other appropriate
code.
3. The client sends the RCPT TO (recipient) message, which
includes the mail
address of the recipient.
4. The server responds with code 250 or some other appropriate
code.
5. The client sends the DATA message to initialize the message
transfer.
6. The server responds with code 354 (start mail input) or some
other appropriate
message.
7. 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.
8. The server responds with code 250 (OK) or some other
appropriate code.
i)
Connection Termination
1 After the message is transferred successfully, the client
terminates the connection. This
phase involves two steps (see
Fig).
2 The client sends the QUIT command.
3 The server responds with code
221 or some other appropriate code.
After the
connection termination phase, the TCP connection must be closed.
No comments:
Post a Comment