SMTP(simple mail transfer protocol).ppsx

anjubala996089 105 views 25 slides Apr 16, 2024
Slide 1
Slide 1 of 25
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25

About This Presentation

simple mail transfer protocol


Slide Content

1
SMTP
(Simple Mail Transfer Protocol)
Prepared by:
AnjuBala
A.P.( CSE)

2
OUTLINE
•Introduction to SMTP
•E-Mail
•SMTP Model
•SMTP Procedure
•Real-Email System

3
SMTP
•The most important component of the TCP/IP electronic mail
system is the Simple Mail Transfer Protocol (SMTP).
•Derived from the earlier Mail Transfer Protocol (MTP) which
was first defined in RFC 772 in September 1980, then updated
in RFC 780 in May 1981.
•MTP describes a set of commands and procedures by which
two devices can connect using TCP to exchange e-mail messages.
•SMTP was first defined in RFC 788, published in November
1981.
•RFC 821 defines the SMTP protocol
–How mail MTA (Message transfer agents) exchange
messages .
•RFC 822 defines what a mail message looks like.

4
Electronic Mail
Three major components:
•user agents
–e.g. Outlook, Netscape Messenger
•mail servers
–Incoming, outgoing messages
•Simple Mail Transfer Protocol:
SMTP(Push Protocol)

5
Mail message format
Each mail message contains :
• HEADER: the mail header is terminated by a null line.
• CONTENTS: Everything after the null line (represented as ASCII characters)
Frequently Used fields:
header lines, e.g.,
–To:
–From:
–Subject:
differentfrom SMTP commands!
body
–the “message”, ASCII characters only

6
Electronic Mail: SMTP
•Client’s SMTP mail server establishes a TCP connection
to the recipients SMTP server using Port 25
•three phases in message transfer
–handshaking (greeting)
–transfer of messages
–closure
•command/response interaction
–commands:ASCII text
–response:status code and phrase
•messages must be in 7-bit ASCII

7
SMTP MODEL

8
SMTP MODEL
•SMTP uses the concept of spooling. The idea of spooling is to
allow E-Mail to be sent from a local application to the SMTP
application, which stores the E-Mail in some device or
memory.Once the E-Mail has arrived at the spool, it has been
queued.
•The SMTP protocol describes how two MTA (message
transfer agent) communicate with each other using a single
TCP connection.

9
Operation
•When an SMTP client has a message to transmit, it
establishes a two-way transmission channel to an
SMTP server. The responsibility of an SMTP client is
to transfer mail messages to one or more SMTP servers.
•Once the transmission channel is established and initial
handshaking completed, the SMTP client normally
initiates a mail transaction. Such a transaction consists
of a series of commands to specify the originator and
destination of the mail and transmission of the message
content (including any headers or other structure) itself.

10
Operation (contd..)
•The server responds to each command with a reply;
replies may indicate that the command was accepted,
that additional commands are expected, or that a
temporary or permanent error condition exists.
•Once a given mail message has been transmitted, the
client may either request that the connection be shut
down or may initiate other mail transactions.

11
Basic Commands
SMTP defines a small required command set, with
several optional commands included for
convenience purposes.
•HELO -Initial State Identification
•MAIL-Mail Sender Reverse Path
•RCPT -One Recipient’s Forward Path
•DATA -Mail Message Text State
•RSET -Abort Transaction and Reset all buffers
•NOOP -No Operation
•QUIT-Commit Message and Close Channel

12
Reply Codes
Reply Codes Contain a Lot of Information
354
The first digit indicates
success, failure,
or incomplete
The second digit is the category
of error message
The third digit is the specific
message for that category

13
Most Common Reply Codes
500 Syntax error,command
unrecognized
501 Syntax error in parameters
•502 Command not implemented
•503 Bad sequence of commands
•220 <domain> Service ready
•221 <domain> Service closing transmission channel
•421 <domain> Service not available, closing transmission
channel
•250 Requested mail action okay, completed
•354 Start mail input; end with <CRLF>.<CRLF>
•554 Transaction failed
The first digit indicates status:
1 -3 success, 4 temp negative
5 failure
The second digit is type of error:
0 syntax,2 connection ,5 mail

14
SMTP Procedure
IMPLEMENTATION
•When a transmission channel is established between client and server
the server send a ready signal (220 response) to the client-
220 kuashaonline.com Ready. <CRLF>.
Client then can start the session issuing a HELO command.
The HELO or EHLO command
•These two commands are used to establish a dialog session between
client and server. The client sends HELO command in the following
format to start a session.
HELO <domain> <CRLF>
Here the <domain> is users domain who wish to send a message. If the
server allows an user from this domain it sends OK response-
250 OK <CRLF>

15
Implementation (contd..)
The session is now established and the client now can
send message.
The MAIL Command
•Client starts with MAIL command to send a mail
message-
Ex: MAIL FROM:<[email protected]><CRLF>
Here client assigns the FROM address. Lets assume that
we do accept this from address and send OK.
250 OK<CRLF>
•It is possible to send invalid parameter response (501)
from server if, for example, from address format is not
valid.
501 Syntax error in parameters or arguments <CRLF>

16
Contd…
The RCPT Command
The client sets to address with this command.
Example: RCPT TO:[email protected]<CRLF>
Lets assume that our SMTP server can accept the message to store the
message (if it is local) or can relay the message to destination SMTP
server somehow. So we accept it
250 OK<CRLF>

17
Contd…
The DATA Command
Client sends DATA command to start sending data
DATA <CRLF>
The server now sets its state to receive data and send affirmative
result to client using 354 return
354 Start mail input; end with [CRLF]. [CRLF] <CRLF>
When client receives this reply client start to send the mail body.
The QUIT Command
OK, we are finished with the sending mail. Client should now
send QUIT command
QUIT<CRLF>
And server closes the session by sending 221 response.
221 Service closing transmission channel.

18
Example of the SMTP Data Flow
•R:220 Beta.ARPA Simple Mail Transfer Service Ready Sendmail
S: HELO Alpha.ARPA
R: 250 Beta.ARPA
S: MAIL FROM:<[email protected]>
R: 250 OK
S: RCPT TO:<[email protected]>
R: 250 OK
S: RCPT TO:<[email protected]>
R: 550 No such user here
S: RCPT TO:<[email protected]>
R: 250 OK
S: DATA
R: 354 Start mail input; end with "."
S: HELLO ...
S: ...etc. etc. etc.
S: .
R: 250 OK.
•S:QUIT
•R: 221 Closing connection.

19
Real-Email System

20
•Real e-mail system consists of two different servers running on a server
machine. One is called the SMTP server, where SMTP stands for Simple
Mail Transfer Protocol. The SMTP server handles outgoing mail. The other
is either a POP3 serveror an IMAP server, both of which handle
incoming mail. POP stands for Post Office Protocol, and IMAP stands for
Internet Mail Access Protocol.
The SMTP Server

21
The POP3 and IMAP (message access agents)Servers
•POP3 and IMAP deal with the receiving of e-mail & to read the
mail.
•POP3 maintains a collection of text files --one for each e-mail
account. When a message arrives, the POP3 server simply appends
it to the bottom of the recipient's file.
•When you check your e-mail, your e-mail client connects to the
POP3 server using port 110. Once you've logged in, the POP3 server
opens your text file and allows you to access it.
•IMAP (Internet Mail Access Protocol)With IMAP, your
mail stays on the e-mail server. You can organize your mail into
folders. When you search your e-mail, the search occurs on the
server machine, rather than on your machine.

22
Problems with simple SMTP
•first relates to timeouts. If the Client and server have different
timeouts, one of them may give up while the other is still busy,
unexpectedly terminating the connection.
•Infinite mail storms can be triggered. For example, If host 1 holds
mailing list A and host 2 holds mailing list B and each list contains
an entry for the other one, then a message sent to either list could
generate a never ending amount of email traffic unless somebody
checks for it.

23
ESMTP (RFC 2821)
To get around the problems with simple SMTP, extended SMTP has
been defined in RFC 2821. Clients wanting to use it should send an
EHLO message instead of HELO initially. If this is rejected, then the
server is a regular SMTP server, and the client should proceed in the
usual way. If the EHLO is accepted, then new commands and
parameters are allowed.
SMTP Security
One of the limitations of the original SMTP is that it has no facility for
authentication of senders. Therefore the SMTP-AUTHextension was
defined. In spite of this, E-mail spamming is still a major problem.
INTERNET MAIL 2000is one such proposal for replacement.

24
References
•RFC 821 -
http://www.ietf.org/rfc/rfc0821.txt
•www.cs.lmu.edu/~ray/notes/smtp/
•http://www.emailaddressmanager.com/tips
/protocol.html
•http://www.faqs.org/rfcs/rfc821.html
•Data Communication & Networking
Behrouz A Forouzan

25
THANKS
Tags