The Wayback Machine - https://web.archive.org/web/20240920231217/https://www.geeksforgeeks.org/simple-mail-transfer-protocol-smtp/
Open In App

Simple Mail Transfer Protocol (SMTP)

Last Updated : 26 Jun, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Simple Mail Transfer mechanism (SMTP) is a mechanism for exchanging email messages between servers. It is an essential component of the email communication process and operates at the application layer of the TCP/IP protocol stack. SMTP is a protocol for transmitting and receiving email messages. In this article, we are going to discuss every point about SMTP.

What is Simple Mail Transfer Protocol?

SMTP is an application layer protocol. The client who wants to send the mail opens a TCP connection to the SMTP server and then sends the mail across the connection. The SMTP server is an always-on listening mode. As soon as it listens for a TCP connection from any client, the SMTP process initiates a connection through port 25. After successfully establishing a TCP connection the client process sends the mail instantly. 

Simple Mail Transfer Protocol

SMTP

SMTP Protocol

The SMTP model is of two types:

  • End-to-End Method
  • Store-and-Forward Method

The end-to-end model is used to communicate between different organizations whereas the store and forward method is used within an organization. An SMTP client who wants to send the mail will contact the destination’s host SMTP directly, to send the mail to the destination. The SMTP server will keep the mail to itself until it is successfully copied to the receiver’s SMTP. 
The client SMTP is the one that initiates the session so let us call it the client-SMTP and the server SMTP is the one that responds to the session request so let us call it receiver-SMTP. The client-SMTP will start the session and the receiver SMTP will respond to the request. 

Model of SMTP System 

In the SMTP model user deals with the user agent (UA), for example, Microsoft Outlook, Netscape, Mozilla, etc. To exchange the mail using TCP, MTA is used. The user sending the mail doesn’t have to deal with MTA as it is the responsibility of the system admin to set up a local MTA. The MTA maintains a small queue of mail so that it can schedule repeat delivery of mail in case the receiver is not available. The MTA delivers the mail to the mailboxes and the information can later be downloaded by the user agents.

SMTP Model

SMTP Model

Components of SMTP

  • Mail User Agent (MUA): It is a computer application that helps you in sending and retrieving mail. It is responsible for creating email messages for transfer to the mail transfer agent(MTA).
  • Mail Submission Agent (MSA): It is a computer program that receives mail from a Mail User Agent(MUA) and interacts with the Mail Transfer Agent(MTA) for the transfer of the mail.
  • Mail Transfer Agent (MTA): It is software that has the work to transfer mail from one system to another with the help of SMTP.
  • Mail Delivery Agent (MDA): A mail Delivery agent or Local Delivery Agent is basically a system that helps in the delivery of mail to the local system. 

How does SMTP Work?

  • Communication between the sender and the receiver: The sender’s user agent prepares the message and sends it to the MTA. The MTA’s responsibility is to transfer the mail across the network to the receiver’s MTA. To send mail, a system must have a client MTA, and to receive mail, a system must have a server MTA. 
  • Sending Emails: Mail is sent by a series of request and response messages between the client and the server. The message which is sent across consists of a header and a body. A null line is used to terminate the mail header and everything after the null line is considered the body of the message, which is a sequence of ASCII characters. The message body contains the actual information read by the receipt. 
  • Receiving Emails: The user agent on the server-side checks the mailboxes at a particular time of intervals. If any information is received, it informs the user about the mail. When the user tries to read the mail it displays a list of emails with a short description of each mail in the mailbox. By selecting any of the mail users can view its contents on the terminal.
Working of SMTP

Working of SMTP

What is an SMTP Envelope?

  • Purpose
    • The SMTP envelope contains information that guides email delivery between servers.
    • It is distinct from the email headers and body and is not visible to the email recipient.
  • Contents of the SMTP Envelope
    • Sender Address: Specifies where the email originates.
    • Recipient Addresses: Indicates where the email should be delivered.
    • Routing Information: Helps servers determine the path for email delivery.
  • Comparison to Regular Mail
    • Think of the SMTP envelope as the address on a physical envelope for regular mail.
    • Just like an envelope guides postal delivery, the SMTP envelope directs email servers on where to send the email.

What are SMTP Commands?

S.No.  Keywor  Command form   Description   Usage  
1. HELO HELO<SP><domain><CRLF> It provides the identification of the sender i.e. the host name. Mandatory
2. MAIL MAIL<SP>FROM : <reverse-path><CRLF> It specifies the originator of the mail. Mandatory
3. RCPT RCPT<SP>TO : <forward-path><CRLF> It specifies the recipient of mail. Mandatory
4. DATA DATA<CRLF> It specifies the beginning of the mail. Mandatory
5. QUIT QUIT<CRLF> It closes the TCP connection. Mandatory
6. RSET RSET<CRLF> It aborts the current mail transaction but the TCP connection remains open. Highly recommended
7. VRFY VRFY<SP><string><CRLF> It is use to confirm or verify the user name. Highly recommended
8. NOOP NOOP<CRLF> No operation Highly recommended
9. TURN TURN<CRLF> It reverses the role of sender and receiver. Seldom used
10. EXPN EXPN<SP><string><CRLF> It specifies the mailing list to be expanded. Seldom used
11. HELP HELP<SP><string><CRLF> It send some specific documentation to the system. Seldom used
12. SEND SEND<SP>FROM : <reverse-path><CRLF> It send mail to the terminal. Seldom used
13. SOML SOML<SP>FROM : <reverse-path><CRLF> It send mail to the terminal if possible; otherwise to mailbox. Seldom used
14. SAML SAML<SP>FROM : <reverse-path><CRLF> It send mail to the terminal and mailbox. Seldom used

What port does SMTP use?

The Simple Mail Transfer Protocol (SMTP) commonly uses port 587 for secure transmission via TLS. While port 465 was previously supported by many providers, it is no longer an accepted standard. Additionally, port 25 is mainly used for SMTP relay, not for SMTP submission. Although port 2525 is not an official SMTP port, it can serve as a good alternative

Difference Between SMTP and Extended SMTP

SMTP Extended SMTP
Users were not verified in SMTP as a result of massive-scale scam emails being sent. In Extended SMTP, authentication of the sender is done.                                   
We cannot attach a Multimedia file in SMTP directly without the help of MMIE. We can directly attach Multimedia FIle in ESMTP.
We cannot reduce the size of the email in SMTP. We can reduce the size of the email in Extended SMTP.
SMTP clients open transmission with the command HELO. The main identification feature for ESMTP clients is to open a transmission with the command EHLO (Extended HELLO).

Advantages of SMTP

  • If necessary, the users can have a dedicated server.
  • It allows for bulk mailing.
  • Low cost and wide coverage area.
  • Offer choices for email tracking.
  • Reliable and prompt email delivery.

Disadvantages of SMTP

  • SMTP’s common port can be blocked by several firewalls.
  • SMTP security is a bigger problem.
  • Its simplicity restricts how useful it can be.
  • Just 7-bit ASCII characters can be used.
  • If a message is longer than a certain length, SMTP servers may reject the entire message.
  • Delivering your message will typically involve additional back-and-forth processing between servers, which will delay sending and raise the likelihood that it won’t be sent.

SMTP vs POP vs IMAP

SMTP

POP

IMAP

Stands for Simple mail transfer protocol

Stands for Post Office Protocol.

Stands for Internet Message Access Protocol.

Used for sending mail.

Used for retrieving mail.

Used for retrieving mail.

it is push protocol.

it is pull protocol.

it is pull protocol.

It work between sender’s mail server to receiver’s mail server and sender and sender’s mail server.

It work between receiver and receiver’s mail server.

It works between receiver and receiver’s mail server.

It does not store mail on server it just send the mail.

It download all the mail when it connected to internet.

It store all mail on server and download when it get request to download.

Works on TCP port number 25.

Works on TCP port number 110.

Works on TCP port number 143.

Connection oriented protocol.

Connection oriented protocol.

Connection oriented protocol.

It has persistence TCP connection.

It has persistence TCP connection.

It has persistence TCP connection.

Stateless protocol.

Stateful protocol.

Stateful protocol.

It is in band protocol.

It is in band protocol.

It is in band protocol.

Not used at receiver side.

Used at receiver side.

Used at receiver side.

Conclusion

SMTP is a fundamental part of email communication that allows messages to be reliably transmitted between email servers. Despite its drawbacks, such as security problems and the possibility of spam, SMTP is still widely used due to its simplicity, efficiency, and broad support across various email systems. Enhancements such as encryption and authentication may solve some of its security issues, making it an appropriate choice for email delivery in a variety of applications.

Frequently Asked Questions on SMTP – FAQs

What is the default port for SMTP?

The default port for Simple mail Transfer Protocol is port 25.

What is SMTP Relay?

SMTP Relay can be basically defined as the process of transferring emails from one server to another server.

Describe some common issues in SMTP Email Delivery.

Some common issues that appeared in SMTP Email Delivery is Blocked Ports, Authrntication Problem, etc.



Previous Article
Next Article

Similar Reads

What is ESMTP (Extended Simple Mail Transfer Protocol)?
Due to emerging computer science technology and connecting the world through the internet and to have communication between different computers SMTP protocol is being used. Email is widely used by users all over the internet whether to share information in text format or in different multimedia forms. There is a certain set of rules defined for sen
4 min read
Difference between File Transfer Protocol (FTP) and Secure File Transfer Protocol (SFTP)
Data transfer is the most common task in network and system communications, and they involve transfer of files using two means i.e the File Transfer Protocol (FTP) and the Secure File Transfer Protocol (SFTP). FTP is a commonly applied protocol that enables files to be transferred through a network from one computer to another, but FTP is unsecure
5 min read
Multipurpose Internet Mail Extension (MIME) Protocol
Multipurpose Internet Mail Extension (MIME) is a standard that was proposed by Bell Communications in 1991 in order to expand the limited capabilities of email. MIME is a kind of add-on or a supplementary protocol that allows non-ASCII data to be sent through SMTP. It allows the users to exchange different kinds of data files on the Internet: audio
4 min read
What is Anonymous FTP (File Transfer Protocol)?
AFTP (Anonymous File Transfer Protocol) is a network protocol used for transmitting files using TCP-based networks. Anonymous file transfer protocol lets a user move files anonymously from one computer to another. Anonymous FTP operates at layer 7; anonymous FTP permits anonymous external computer users without any designated password or user ID to
3 min read
Principle Of Reliable Data Transfer Protocol
Transport Layer Protocols are central piece of layered architectures, these provides the logical communication between application processes. These processes uses the logical communication to transfer data from transport layer to network layer and this transfer of data should be reliable and secure. The data is transferred in the form of packets bu
3 min read
Network News Transfer Protocol (NNTP)
Network News Transfer Protocol (NNTP) is the underlying protocol of UseNet, which is a worldwide discussion system which contains posts or articles which are known as news. Network News Transfer Protocol is used to transfer news from one network to another. It is designed specifically to transfer news/articles. A NNTP client is included in browsers
2 min read
XMODEM File Transfer Protocol
XMODEM is a file transfer protocol which enables users to transmit files between different computers. History : XMODEM was developed by Ward Christensen in 1977 and since then the method of sharing files has changed. It became extremely popular in the early bulletin board system (BBS) market because of its simple implementation. However it became i
4 min read
SFTP File Transfer Protocol
SFTP (Secure File Transfer Protocol) is the advanced version of FTP(file transfer protocol) which ensures security while transferring files between the organizations/computer. It is also known as SSH(Secure Shell). It works on port no. 22 and uses the client-server model. Features of SFTP : It encrypts the data.It executes the command.It secures an
3 min read
File transfer protocol server configuration using cisco packet tracer
In this article we are going to design a file transfer protocol server configuration in cisco packet tracer and checking the connectivity for uploading and downloading the file from remote PC. Objectives: To Configure FTP Services on Server.To Upload a File into the FTP Server from Remote PC.To Download a File from the FTP Server from Remote PC.Pro
3 min read
What is TFTP (Trivial File Transfer Protocol)?
The network is made up of various devices. These devices are either connected by ethernet or by any wireless means. The communication for transferring files takes place between these connected devices. Therefore network protocols are required. Network protocols are defined as rules that describe the format of data, sending and receiving of data bet
5 min read
File Transfer Protocol (FTP) in Application Layer
FTP or File Transfer Protocol is said to be one of the earliest and also the most common forms of transferring files on the internet. Located in the application layer of the OSI model, FTP is a basic system that helps in transferring files between a client and a server. It is what makes the FTP unique that the system provides a reliable and efficie
11 min read
Hot Standby Router Protocol (HSRP) and Virtual Router Redundancy Protocol (VRRP)
Hot Standby Router Protocol (HSRP) is a CISCO proprietary protocol used to provide redundancy in a network. Only one router is the active router while others will be in standby state i.e the standby router will be responsible for forwarding the traffic when the active router fails. Virtual Router Redundancy Protocol (VRRP) is an open standard proto
3 min read
Cisco Discovery Protocol (CDP) and Link Layer Discovery Protocol (LLDP) in Data Link Layer
Layer 2 or the Datalink layer provides physical addressing and access to media. It defines how data is to be formatted for transmission and how access to the network is to be controlled. It also provides error detection, ensuring data on higher layers is formatted correctly for transmission. Cisco Discovery Protocol (CDP) and Link Layer Discovery P
2 min read
Difference between Stop and Wait protocol and Sliding Window protocol
Both the Stop and Wait protocol and the Sliding Window protocol are the techniques to the solution of flow control handling. The main difference between the Stop-and-wait protocol and the Sliding window protocol is that in the Stop-and-Wait Protocol, the sender sends one frame and waits for acknowledgment from the receiver whereas in the sliding wi
5 min read
Difference between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP)
When dealing with network routing, it's crucial to understand the various protocols that help direct traffic across complex networks. Two significant protocols in this space are the Border Gateway Protocol (BGP) and the Routing Information Protocol (RIP). Each serves different purposes and operates under different principles. This article explores
5 min read
Difference between Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP)
Spanning Tree Protocol (STP) and Rapid Spanning Tree Protocol (RSTP), are designed to avoid network loops in Ethernet. It provide loop-free logical topology. They were both designed to provide network reliability and particularly avoid broadcast radiation, but the major differences are on the rate, functionality and versatility. In this article we
5 min read
Difference between Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP)
SLIP and PPP, which are the widely used serial connection techniques, help to connect the distant devices of the network. The fullform of SLIP is Session Layer Internetworking Protocol. SLIP being a primitive protocol put into use during the early connections to the Internet, when there was not much overhead. PPP is slightly more complex as the pro
6 min read
SMTP Responses
Simple Mail Transfer Protocol (SMTP) responses are sent from server to client. Each response in SMTP begins with three digit code and it may be followed by additional textual information. The leading digits in response indicate category of response. Following are different categories of the responses : 1. Positive completion reply 2. Positive Inter
2 min read
SMTP Commands
Simple Mail Transfer Protocol (SMTP) is an ASCII protocol. It is based on client-server model. It 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 to port 25 of the destination machine. To send mail, a system must contain client MTA and to receive a ma
2 min read
Difference between MAPI and SMTP
1. Message Application Programming Interface (MAPI) :It is a protocol that is proprietary used by Microsoft that allows Microsoft Outlook email clients to appropriately use the functions of an Exchange Server including email and other folders. MAPI allows us to move the message from the cloud storage onto local storage. This feature allows us to ba
2 min read
Difference Between SMTP and HTTP
Pre-requisites: SMTP, HTTP A network protocol is an accepted set of rules that govern data communication between different devices in the network. In this article, we will see the difference between SMTP and HTTP protocols. SMTPSMTP (Simple Mail Transfer Protocol) is a protocol for managing Internet’s electronic mail. It is an application layer pro
2 min read
IMAP vs POP3 vs SMTP
In this article, we'll look at the basic email systems (SMTP, POP, and IMAP). Each of these protocols has its own specific purposes and traits that make it an important part of email exchange. As we go through their meanings and differences, we'll make it clear how they work together to help us manage email. What is SMTP Protocol?The full form of S
4 min read
Difference Between SMTP and LMTP
SMTP and LMTP are the transmission protocols. The full form of SMTP is Simple Mail Transfer Protocol, as the name suggests; it simply transfers the email messages to another over the internet. It works over the wide-area network and the port 25 used in SMTP. The full form of LMTP is a Local Mail Transfer Protocol that transfers email messages to an
5 min read
SMTP Extensions: STARTTLS, and DANE
SMTP stands for Simple Mail Transfer Protocol. SMTP is an application layer protocol. Whenever a client needs to send mail, opens a TCP connection to the SMTP server and then sends mail over the network. The connection is established by the SMTP server through port 25. What are SMTP Extensions?SMTP extensions are enhancements to the basic Simple Ma
5 min read
Difference between SMTP and POP3
In Computer Network,for sending and receiving messages, we use two protocols one is SMTP (Simple Mail Transfer Protocol) and another is POP3 (Post Office Protocol version 3). They are also called as PUSH and POP protocols respectively. They are agents, Message Transfer Agent, and Message Access Agent respectively to send and retrieve the messages.
4 min read
Difference between IMAP and SMTP
The Application Layer of OSI model is responsible for providing network services directly to user applications. IMAP and SMTP protocol operate at the Application Layer. IMAP (internet message access protocol) and SMTP (simple mail transfer protocol) both are used for email communication. By using IMAP, retrieving emails from the server. While by us
4 min read
Construct a simple HTTP request on TCP protocol
HTTP Request : HTTP messages are how data is exchanged between a server and a client. In this, there are two types of messages where one is HTTP client request and the second is the response from the server.Messages in textual form and it is encoded in ASCII form, and span over multiple lines. And messages were openly sent across the connection in
3 min read
Simple Network Management Protocol (SNMP)
Simple Network Management Protocol (SNMP) is a widely used protocol for network management that provides a standardized framework for monitoring and managing network devices such as routers, switches, servers, and printers. It operates within the application layer of the Internet protocol suite and allows network administrators to manage network pe
6 min read
Privacy Enhanced Mail (PEM) and it's Working
Privacy Enhanced Mail (PEM) is an email security standard to provide secure electronic mail communication over the internet. Security of email messages has become extremely important nowadays. In order to deal with the security issues of emails the internet architecture board has adopted it. The PEM mainly provides the following services - Confiden
3 min read
Difference between Spam and Phishing Mail
Email as a medium of communication has evolved into a vital one for family and friends, businesses, and other entities around the globe. Unfortunately, the use of this word has been on the rise and so has the dangers of it. The two basic risks that are relevant to the users are spam and phishing messages. Thus, both of them can distract with Interr
7 min read
Article Tags :