In this article, we will discuss what is simple mail transfer protocol? Its features and components, MIME extension, and also discuss SMTP commands and response codes.
Simple Mail Transfer Protocol (SMTP)
- SMTP stands for Simple Mail Transfer Protocol, is just a simple network protocol that allows us to transfer the email to the email servers using some commands.
- It is a set of commands, used to only send emails over the internet. So whenever you want to send an email you will be using simple mail transfer protocol (SMTP) commands.
- SMTP is used by the clients for sending emails to the server.
- It is a set of network communication guidelines that are used to set up communication rules between servers.
While sending the mail, SMTP is used two times-
- Between the sender and the sender’s mail server
- Between the sender’s mail server and the receiver’s mail server
You can be memorizing it by just remembering-
- S- Send
- M- Mail
- T- To
- P- People
It’s not his full form, it’s for memorizing, full form of SMTP- Simple Mail Transfer Protocol.
Features of SMTP:
Only for Sending Mail: SMTP is always used only for sending the email, not used for receiving the emails. For receiving the email, IMAP or POP3 protocols are used.
Application Layer Protocol: SMTP is an application layer protocol because it is used by the client on an application to send emails to the server.
Works on TCP protocol: It works on TCP protocol at the transport layer because TCP protocol gives guarantee delivery of data.
Actually, there are two protocols on the transport layer, TCP and UDP.
- UDP is a connectionless protocol, where no acknowledgment of sending data.
- TCP is a connection-oriented protocol, which created a connection between the sender and receiver and ensures the delivery of data by using acknowledgment. So SMTP is a connection-oriented protocol because it works with TCP
Use TCP port 25: It uses TCP port 25, which is a default non-encrypted port. It also uses TCP port 465, which is an encrypted port, used to send message security.
It is a Push protocol: There are two protocols: Push protocol and Pull protocol.
- SMTP is a push protocol because it is used only to push the mail.
- IMAP and POP3 are the pull protocol because they are used to receiving the mail.
Use 7-bit ASCII format: SMTP use 7-bit ASCII format for sending each message.
Components of Simple Mail Transfer Protocol
There are two primary components- SMTP Client and SMTP Server.
SMTP client acts as the agent for the users, called user agent (UA). User agents (UA) are the application can be Gmail, yahoo mail, outlook, Netscape, etc. which provides a working environment for sending mail. Sender sends the message with the help of a user agent (UA). So when the user wants to send the mail, the user agent (UA) is responsible to create the message and puts it’s in the envelope.
SMTP servers are the servers, which manage the whole SMTP process. SMTP server is available on both sender’s and receiver’s sides to manage their users. They are the agents on both sides for transferring the messages also called Mail Transfer Agent (MTA).
When the user agent (UA) transfers the mail, the mail transfer agent (MTA) is responsible to transfer the messages to the receiver’s MTA, using TCP connections. MTA manages the whole process and maintains a small queue of mails because It also manages other user’s mails.
The MTA is responsible to deliver the email to the mailbox of the receiver, then the receiver can read the mails later by the user agents (UA).
The users only deal with the user agents (UA), they do not have to any deal with the MTA.
MIME is an extension that extends the limited capability of email.
Actually, SMTP is a pure text-based protocol means it can only handle 7 bit ASCII text. It does not have any capability to transfer other types of data like images, videos, audios, etc. It cannot transfer executable files and binary objects and also cannot transfer the text data of other languages like- French, Japanese, and Chinese, etc.
So to solve these problems Multipurpose Internet Mail Extensions (MIME) introduced, which was specially designed for SMTP. MIME extension extends the capability of SMTP, which enables the users to transfer images, video files, audio files, executable files, etc. It also enables to transfer of messages in other languages like- French, Japanese, etc.
SMTP Commands and Response Codes
SMTP is a program, which works as a protocol for sending mails. For sending the mail, the sender’s mail server and receiver’s mail server communicate with each other using SMTP protocol.
For communication, Sender’s mail server always sends commands for sending the mail and the receiver’s mail server accepts those commands and always reacts with the response code instead.
Some SMTP commands
HELO/EHLO: It is the first SMTP command and the conversation start with this command, use to identify the domain like- gmail.com
MAIL FROM: It indicates the sender’s email address.
RCPT TO: It indicates the recipient’s email address. If there are multiple recipients, this command can be repeated multiple times.
SIZE: This command is used to tell the estimated size (in terms of bytes) of the attached email.
DATA: This command tells the SMTP receiver, next the stream of data will follow.
VRFY: This is a verify command, used to verify the email address.
QUIT: This command is used to terminate the connection.
Some SMTP response codes:
101: Server connection error (wrong server name or connection port).
211: System status (response to HELP command).
214: Help message (response to HELP command).
220: The server is ready (response to the client’s attempt to establish a TCP connection).
221: The server closes the transmission channel.
235: Authentication successful (response to AUTH command).
250: The requested command is completed. As a rule, the code is followed by OK.
354: The server confirms mail content transfer (response to DATA command).
500: Syntax error means the server cannot recognize the command.
510: Invalid email address.
Simple Mail Transfer Protocol Workflow
You can also Read: