What is Simple Mail Transfer Protocol? what is SMTP?SMTP commands, SMTP responses and mail transfer phases. - Cyber security & Technology

Breaking

Tuesday, July 24, 2018

What is Simple Mail Transfer Protocol? what is SMTP?SMTP commands, SMTP responses and mail transfer phases.






SIMPLE MAIL TRANSFER PROTOCOL (SMTP)


·        SMTP is a simple ASCII protocol that is based on client server model.







·        SMTP uses TCP port number 25 for this service. Therefore e-mail is delivered from source to destination by having the source machine established a TCP connection to port 25 of the destination machine.

·        To send a mail, a system must have a client MTA, and to receive a mail, a system must have a server MTA. SMTP transfers this message from client MTA to server MTA

·        In order to send a mail, SMTP is used two times: one between the sender and the sender's mail server, and the other between the two mail servers, as shown in figure. Thus SMTP handles exchange of messages between e- mail servers over TCP/IP network.

·        Although SMTP is an efficient and reliable e-mail protocol. It suffers from following problems:

1.       It limits the size of the message and cannot handle message above a certain defined length.

2.      It does not support audio, video and images.

3.      It lacks security and is easily used by intruders.

·        SMTP uses commands and responses to transfer the message between an MTA client and MTA server (see fig.).

·        Each command or response ends with two characters (CR and LF) CR stands for Carriage Return and LF stands for Line Feed.



SMTP commands

·        SMTP commands are sent from the client to the server.

·        Each command consists of a keyword or command name followed by zero or more argument. It means some keywords do not contain any argument.

·        The format of command is:

Keyword : argument(s)

·        There are 14 different SMTP commands listed in the table:

S. NO.
Keyword
Command form
Description


HELO
HELO<SP><domain>
<CRLF>
Provides senders identification i.e. the host name.
Mandatory
1.       
MAIL
MAIL<SP>FROM:<reverse-path><CRLF>
Specifies the originator of mail.
Mandatory
2.       
RCPT
RCPT<SP>TO: <forward-path><CRLF>
Specifies the recipient of mail.
Mandatory
3.       
DATA
DATA<CRLF>
Specifies the beginning of mail.
Mandatory
4.      Q
QUIT
QUIT<CRLF>
Closes the TCP connection
Mandatory
5.       
RSET
RSET<CRLF>
Abort the current mail transaction TCP connection remains open.
Highly recommended
6.       
VRFY
VRFY <SP><string><CRLF>
To confirm or verify user name
Highly recommended
7.       
NOOP
NOOP <CRLF>
No operation
Highly recommender
8.       
TURN
TURN<CRLF>
Reverse the role of sender and receiver
Seldom used
9.       
EXPN
EXPN <SP><string><CRLF>
Specifies the mailing list to be expanded.
Seldom used
10.    
HELP
HELP<SP><String><CRLF>
Send system specific documentation.
Seldom used
11.    
SEND
SEND<SP>From: <reverse path><CRLF>
Send mail to terminal
Seldom used
12.    
SOML
SOML<SP> FROM: <reverse-path><CRLF>
Send mail to terminal if possible: otherwise to mailbox.
Seldom used
13.    
SAML
SAML <SP>FROM:  <reverse-path><CRLF>
Send mail to terminal & mailbox.
Seldom used



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.

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

4.      Permanent Negative Completion reply. It indicates the command was not accepted and the requested action did not occur.

Mail Transfer Phases

The basic SMTP operation occurs in three phases:

1.      Connection set up

2.      Mail transfer

3.      Connection termination

Connection Set up

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:

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.

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.

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.

No comments:

Post a Comment