Simple Mail Transfer Protocol (SMTP)
One of the most useful services on the internet today is emerging as email. The majority of internet-based systems employ SMTP as a means of sending mail from one user to another. POP (post office protocol) or IMAP (internet message access protocol) are used to retrieve those emails at the recipient’s side while SMTP (a push protocol) is used to send the mail.
SMTP Fundamentals
An application layer protocol is SMTP. A TCP connection is established between the client and the SMTP server before the mail is sent over the connection. The SMTP server operates in listening mode constantly. The SMTP process starts a connection through port 25 as soon as it starts listening for a TCP connection from any client. Once a TCP connection has been established successfully, the client process immediately sends the email.
Working of SMTP
- Composition of Mail: Using a Mail User Agent, a user composes an electronic mail message and sends it (MUA). An application used to send and receive mail is called Mail User Agent. The message is divided into two sections: body and header. While the header contains details like the sender and recipient addresses, the message’s body is its primary component. The message’s subject and other descriptive information are included in the header. In this instance, the header is analogous to an envelope containing the address of the recipient, and the message body is analogous to a letter.
- Submission of Mail: The email is then sent to the SMTP server using SMTP on TCP port 25 by the mail client after it has finished writing it.
- Delivery of Mail: The recipient’s username and the domain name are the two components of an email address. For instance, rohit@gmail.com, where the recipient’s username is “rohit” and the domain name is “gmail.com.”Mail will be sent to the Mail Transfer Agent if the recipient’s email address’s domain name differs from the sender’s domain name (MTA). The MTA will locate the target domain and relay the email there. To obtain the target domain, it looks up the MX record from the Domain Name System. The IP address and domain name of the recipient’s domain are listed in the MX record. MTA establishes a connection with the exchange server to relay the message after locating the record.
- Receipt and Processing of Mail: Once the incoming message is received, the exchange server sends it to the mail delivery agent (incoming server), which stores the email and makes it available for user retrieval.
- Access and Retrieval of Mail: Using MUA, one can retrieve the emails that were saved in MDA (Mail User Agent). MUA is accessible with a login and password.
Model of SMTP system
In the SMTP model, the user interacts with the user agent (UA), which can be Mozilla, Netscape, or Microsoft Outlook, among others. MTA is utilised in order to exchange mail over TCP. The system administrator is in charge of setting up a local MTA, so the user sending the mail doesn’t have to deal with it. The MTA keeps a small queue of mails in order to plan repeat mail delivery in the event that the recipient is not present. User agents can later download the data after the MTA delivers the mail to the mailboxes.
Both the SMTP-client and SMTP-server should have 2 components:
- User-agent (UA)
- Local MTA
Communication between sender and the receiver : The message is prepared and sent to the MTA by the sender’s user agent. Transferring the mail across the network to the recipient’s MTA is the MTA’s duty. A system must have a client MTA in order to send emails, and a server MTA in order to receive emails.
SENDING EMAIL: Messages between the client and the server that request and respond are used to send mail. A header and a body are both parts of the message that is sent. The mail header is terminated by a null line, and everything that comes after it is regarded as the message body and is made up of ASCII characters. The information that was actually read by the receipt is contained in the message body.
RECEIVING EMAIL: At predetermined intervals, the user agent on the server checks the mailboxes. It alerts the user to any information received if any. When a user attempts to read their email, a list of emails is displayed along with a brief description of each message. Users can view a message’s contents on the terminal by selecting any one of the mails..