2. SMTP INTRADUCTION :
• It is a TCP/IP protocol that specifies how computers
exchange electronic mail.
• It works with post office protocol (POP).
• SMTP stands for Simple Mail Protocol
• The actual mail transfer is done through messgae
transfer agents
• To send mail, a system must have the client MTA & to
receive mail, a system must have a server MTA
• The formal protocol that defines the MTA client &
server in the Internet is called the simple mail transfer
protocol
3. Continue……
• As we said before two pairs of MTA clients /
server program are used in most common
situation
• Fig : SMTP range
4. Continue….
• SMTP is used two times , between the sender &
the sender’s mail server and between the two
servers.
• SMTP simply define how command & response
must be back & forth. Each network is free to
choose a software package for implementation
5. Basic SMTP ArchitectureBasic SMTP Architecture
• SMTP clients and servers have
two main components:
1.User Agents (UA):
• It prepares a message and
encloses in an envelope.
2.Mail Transfer Agents
(MTA):
• It transfers the mail
across the internet.
6. Commands and Responses :
• SMTP uses commands & response to transfer message
between on MTA client & in MTA server
• Each commands or reply is terminated by a two character
(carriage return & line feed) end-of-line token
7. Commands format :
• Command are sent from the client to the server.
• It is consist of a keyword by zero/more arguments SMTP
defines 14 commands.
• It means some keywords do not contain any argument.
• The first five are mandatory; every implemenatation must
support these five commands.
• The next three are aften used & highly recommended. The
last six are seldom used
Keyword : argument(s)
8. SMTP Responses :
• • SMTP responses are sent from server to client.
• • Each response begins with a three digit code and may
be followed by additional textual information.
• • The leading digits indicate the category of the
response.
9. The difference categories of response are:
1. Positive completion reply. It indicates that the requested action
has been successfully completed. A new request may be initiated.
• 2. Positive Intermediate reply. It indicates that the command has
been accepted, but the requested action is being held in abeyance,
pending receipt of further information.
• 3. Transient Negative Completion reply. It indicates that the
command was not accepted and the requested action did not occur.
However, the error condition is temporary and the action may be
requested.
• 4. Permanent Negative Completion reply. It indicates the
command was not accepted and the requested action did not occur.
10. Mail Transfer Phases
The basic SMTP operation occurs in three phases:
• 1. Connection set up
• 2. Mail transfer
• 3. Connection termination
• Connection Setup:
• An SMTP sender will attempt to set up a TCP connection
with a target host when it has one or more mail message
to deliver to that host. The following sequence occurs
during connection setup:
11. ..…continue
• 1. The sender opens a TCP connection with the receiver.
• 2. Once the connection is established, the receiver identifies itself
with '220 Service Ready".
• 3. The sender identifies itself with the HELO command.
• 4. The receiver accepts the sender's identification with "250 'OK".
• 5. If the mail service on the destination is not available, the
destination host returns a "421 Service Not Available" reply in step 2
and the process is terminated.
12. Mail transfer :
• Once the connection has been established, the SMTP sender may
send one or more messages to the SMTP receiver.
• • There are three logical phases to the transfer of a message :
• 1. A MAIL command identifies the originator of the message.
• 2. One or more RCPT commands identify the recipients of this
message.
• 3. A DATA command transfers the message text.
13. Connection termination :
• • The SMTP sender closes the connection in the following manner:
• 1. The sender sends a QUIT command and waits for a reply.
• 2. Sender initiates TCP close operation for the TCP connection.
• 3. The receiver initiates its TCP close after sending is reply to the
QUIT command.
14. Working of SMTP :
• SMTP is a simple ASCII protocol that is based on client-
server model.
• After establishing the TCP connection, the sending
machine, operating as the client, waits for the receiving
machine, operating as the server, to talk first.
• The server starts by sending a line of text giving its
identity and telling whether or not it is prepared to
receive mail.
• If it is not, the client releases the connection and tries
again later.
15. …..Continue
• If the server is willing to accept e-mail, the client
announces whom the e-mail is coming from and
destination, the server gives the client the go ahead to
send the message.
• Then the client sends the message and the server
acknowledges it.
16. The problems that may arise with SMTP protocol are
as follows:
• Some older version of SMTP implementations cannot
handle messages exceeding 64KB.
• If the client and server have different timeouts, one of
them may give up while the other is still busy,
unexpectedly terminating the connection.
• To get around these problems, extended SMTP
(ESMTP) has been defined in RFC 1425.
17. Commands are listed in table
Keywword Argument(s)
HELO Sender’s host name
MAIL FROM Sender of the message
RCPT NO Intended recipient of the message
DATA Body of the mail
QUIT
RESET
VRFY Name of recipients to be verified
NOOP
EXPN Mailing list to be expanded
HELP Command name
SEND FROM Intended recipients of the message
18. SMTP Process :
• Contact server on well known port
• ASCII oriented command/response
• methodology
– contact server
– wait for greeting
– send HELO
– wait for response
– send command
– wait for response
– repeat last two
19. Commands
• HELP
– identifies the client to the server, fully qualified domain name,
only sent once per session
• MAIL
– initiate a message transfer, fully qualified domain of originator
• RCPT
– follows MAIL, identifies an addressee, typically the fully qualified
name of the addressee
– for multiple addressees use one RCPT for each addressee
• DATA
– send data line by line
– <cr>.<cr> tells server data transfer is over
20. Commands
• RSET
– tells server to abort current message and clear all of it buffers
– same state as after HELO
• SEND , SOML , SAML
– like MAIL, outdated not used any more
• VRFY
– ask server to verify a user name
– server replies positively of it knows user, negatively if not
• EXPN
– ask server to confirm mailing list alias
– server reply is multi-line, one per user
21. Commands
• HELP
– ask server for help
• by itself get a list of server supported commands
• <string> get help for that command
• NOOP
– ask server to respond with a positive reply
• QUIT
– tell server that client is ending session
– server replies positively and closes connection
• TURN
– reverse roles of client and server
• outdated, rarely used on modern internet