Simple Mail Transfer Protocol

Simple Mail Transfer Protocol (SMTP) which is a mail delivery protocol.  SMTP is capable of transporting mail across various networks via a relay or gateway process accessible to both the networks. SMTP was designed as  a mail transport and delivery protocol. But it is also used as a mail submission protocol for split UA (user agents) mail reading systems and mobile environments.


Working of SMTP

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, or report its failure to do so. The servers could be intermediate or the final destination.  An SMTP client determines the address of an appropriate host running an SMTP server by resolving a destination domain name to either an intermediate Mail eXchanger host or a final target host.

SMTP commands are generated by the SMTP client and sent to the SMTP server. SMTP replies are sent from the SMTP server to the SMTP client in response to the commands.

In short, there could be a single hop between sender and server, or multiple hops before the final destination. However,  the protocol requires that a server MUST accept responsibility for either delivering the message or properly reporting the failure to do so.

The main strength of SMTP is its simplicity.

SMTP Protocol

The SMTP – Procedures

The major procedures are as follows:

  1. Session initiation:  An SMTP session is initiated when a client opens a connection with an SMTP server and the server responds with an opening message.
  2. Client initiation: After the client receives the greeting message sent by server, client sends its identity to the server with an EHLO command.  (EHLO indicates service extensions are supported and the list of supported extensions are indicated. )
  3. Mail transaction: Starts with MAIL command that gives sender information. The receiver information is given my a series of RCPT commands. Then DATA command initiates the transfer of mail data which is terminated by “end of mail” data indicator.
  4. Forwarding mail: Servers may forward a message when they are aware of an address change. When they do so, they may provide address-updating information or may forward silently. Also, servers may reject messages as non-deliverable in case it cant deliver to the prescribed address. 
  5. Verifying mailbox names: The VRFY and EXPN commands are used for verification. A server returns a 250 code when the verification is performed successfully.
  6. Session termination: An SMTP connection is terminated when the client sends a QUIT command. The server responds with a positive reply code after which it closes the connection.