Hurry! Try our new Interactive Courses for FREE. 🥳   🚀

SMTP Protocol

In this tutorial, we will be covering the concepts of SMTP in the Application layer of the OSI Model.

SMTP mainly stands for Simple Mail Transfer Protocol. Basically, the actual transfer of mail is done through the message transfer agents(MTA). Thus in order to send the mail, the system must have the client MTA and in order to receive the mail, the system must have a server MTA.

  • In order to define the MTA client and server on the Internet, there is a formal way and it is known as Simple Mail Transfer Protocol(SMTP).

  • SMTP also makes the use of TCP/IP for sending and receiving e-mail.

  • SMTP is based on the client/server model.

  • The original standard port for SMTP is Port 25.

  • Using this protocol, the client who wants to send the e-mail first opens a TCP connection to the SMTP server and then sends the e-mail across the TCP connection. It is important to note that the SMTP server is always in listening mode. As soon as it listens for the TCP connection from any client then the connection is Initiated on port 25 and after the successful connection, the client sends the e-mail/message immediately.

SMTP is used two times while sending an Email:

  1. Between the Sender and Sender's mail server

  2. Between the Sender’s mail server and the Receiver’s mail server

It is important to note that in order to receive or download the email,

  • There is a need for another protocol between the mail server of receiver and the receiver.

  • Commonly used protocols are POP3 and IMAP. Thus these two are mail access agents.

Architecture of SMTP

All the users make use of User Agent (UA). The Mail Transfer Agent (MTA) mainly helps to exchange all the messages in between both sender and receiver using the TCP/IP. The system administrator has the authority to configure the set up of local MTA, thus the users who are sending the email do not need to deal with the MTA.

The MTA keeps the queue in the pool of messages, if the receiver is not available at that moment then MTA can schedule the repeat delivery of all the messages.

MTA (Mail User Agent) forwards the emails into mailboxes of the user's local system, and then the user agent (UA) can download those messages at any time.

The SMTP Client as well as the SMTP server both has two main components and these are:

  • UA(User-Agent)

  • MTA(Mail Transfer Agent)

Let us now take a look at communication between the sender and the receiver:

The user agent at the sender side prepares the message and then sent it to the MTA. The task of the MTA is to transfer the Email across the network to the Receiver MTA. Also in order to send the Email, a system must have the client MTA and in order to receive the email, a system must have a server MTA.

Sending the Email

An email is sent between the sender and receiver using a series of request and response messages. An Email mainly consists of two parts a header and body. The body part of an email indicates the main message area. It is the actual information that is to be read by the receiver. The header mainly contains the address of the sender and recipient and it also contains the subject of the email.

In order to terminate the header of the email, there is a NULL line, everything after the NULL line is considered as the body of the message.

Receiving the Email

Mailboxes are checked by the user agent at the server side at a particular interval of time. In case if any information is received then it informs the receiver about the email.

At the time when the user tries to read the email then MTA mainly displays a list of emails with their short description in the mailbox. If the user selects any of the emails then can easily view the contents inside the email.

SMTP Protocol Method

  1. Store-and-Forward Method
    The store and forward method is used within an organization.

  2. End-to-End Method
    Mainly the end-to-end method is used to communicate between the different organizations

An SMTP client is the one who wants to send the mail and will definitely contact the destination’s host SMTP directly in the order to send the Email to the destination. Also, the session is initiated by the client SMPT.

On the other hand, the SMTP server will keep the mail to itself until it is successfully copied to the SMTP at the receiver. The server SMTP mainly responds to the session request.

Thus the session is started by the client-SMTP and the server-SMTP will respond to the request of the sender.

Characteristics of SMTP

Let us take a look at the characteristics of the SMTP:

  • SMTP makes use of Port 25.

  • It makes use of persistent TCP connections and thus can send multiple emails all at once.

  • It is a stateless protocol.

  • It is a connection-oriented protocol.

  • It makes use of TCP at the transport layer.

  • It is a push control protocol.

Advantages of SMTP

Let us take a look at the advantages offered by the simple mail transfer protocol(SMTP):

  • SMTP offers reliability in terms of the outgoing email messages.

  • It is the simplest form of communication between various computers in a network via Email.

  • In those cases where a particular message was not delivered successfully then, the SMTP server always tries to re-send the same message until the transmission becomes successful.

Disadvantages of SMTP

  • SMTP does not provide good security.

  • It is only limited to 7-bit ASCII characters.

  • Beyond some specific length, email messages are rejected by SMTP servers.

  • The usefulness of SMTP is limited by its simplicity.

  • With the help of SMTP, the transmission of executable files and binary files is not possible until they get converted into text files.