What is the Simple Mail Transfer Protocol?
A simple mail transfer protocol(SMTP) is used to transfer the mails. The actual mail transfer is done through MTA i.e. Message Transfer Agents. To transfer mail from one system to another, the system must have the client message transfer agents and server message transfer agents. The client message transfer agent is used to send the mail and server message transfer agents are used to receive the mail. Simple Mail Transfer Protocol (SMTP) Simple Mail Transfer Protocol is the only protocol that defines Message Transfer Agents (MTA) client and server. Simple mail transfer protocol is used to define how both commands and responses must be sent back and forth. It is used two times, between the sender and the sender’s mail server and between the two mail servers.
How does the Simple Mail Transfer Protocol Work?
To transfer messages between Messages Transfer Agents client and message transfer agents sever, simple mail transfer protocol uses commands and responses.
First, the MTA client sends commands to the MTA server, in response MTA server sends responses to MTA client.
Let us see those commands and responses one by one.
Commands are sent from the client to the server. The syntax of command is shown below.
The simple mail transfer protocol defines different commands shows as below.
The client uses this command to identify itself. The argument is the sender’s hostname. The format is shown below:
2) MAIL FROM
The client uses this command to identify the sender of the message. The argument is the sender’s e-mail address. The format is shown below:
MAIL FROM: firstname.lastname@example.org
3) RCPT TO
The client uses this command to identify the intended recipient of the message. The argument is the receiver’s e-mail address. The format is shown below:
RCPT TO: email@example.com
The client uses this command to send the message. All lines that follow the DATA command consider as a mail message. The format is shown below:
This is the message which is being designed to send to the receiver.
The client uses this command to terminate the message. The format is shown below:
Client uses his command to cancel the current mail transaction. The connection will reset and the stored information about the sender and the receiver will be deleted. The format is shown below:
The client uses this command to verify the receiver’s e-mail address. The format is shown below:
The client uses this command to check the status of the recipient. The format is shown below:
Both the sender and receiver use this command to switch their positions i.e. the sender becomes a receiver and the receiver becomes sender. In today’s world, a simple mail transfer protocol does not support this feature. The format is shown below:
This command asks the receiver’s host to expand the mailing list which is sent as arguments and to return the mailbox addresses of the receiver that comprise the list. The format is shown below:
EXPN: a b c d
This command asks the receiver to send the Information about command which is sent as an argument.
12) SEND FROM
This command specifies that the mail is to be delivered to the terminal of the recipient and no to the mailbox. If the recipient is offline then the mail is bounced.
SEND FROM: firstname.lastname@example.org
13) SMOL FROM
This command specifies that the mail is to be delivered to the terminal or the mailbox of the recipient. If the recipient is online then the mail is sent directly to the terminal. If the recipient is offline, the mail is sent to the mailbox.
SMOL FROM: email@example.com
14) SMAL FROM
This command specifies that the mail is to be delivered to the terminal and the mailbox of the recipient. If the recipient is offline, the mail is sent to the terminal and the mailbox. If a recipient is online, the mail is directly sent to the mailbox.
SMAL FROM: firstname.lastname@example.org
Enables or disables verbose mode.
Inserts an identifier into the batch SMTP response data set.
Responses are sent from the server to the client. It is a 3 digits code that may follow some information in text format. Those Simple mail transfer protocol Response Codes are given as follows:
- 211: Status of the system
- 214: Help message
- 220: Service ready
- 221: Service closing transmission channel
- 250: Requested command complete
- 251: Message will be forwarded
- 354: Start mail input
- 421: Service not available
- 403: User is not authorized to send from this email address. i.e. User need to update the current email address.
- 450: Mailbox not available
- 451: Command aborted due to local error
- 452: Command aborted due to insufficient storage
- 500: Syntax error due to unrecognized command
- 501: Syntax error due to parameter or arguments
- 502: Command not implemented.
- 503: Bad sequence of commands
- 504: Command temporarily not implemented
- 550: Command not executed
- 551: User not local
- 552: Requested action aborted
- 553: Requested action not taken
- 554: Transaction failed
In this article we have seen what is Simple Mail Transfer Protocol, how does it work along with commands to establish, maintain and terminate the Simple Mail Transfer Protocol configuration.
This is a guide to the Simple Mail Transfer Protocol. Here we have discussed the How does the (SMTP) Simple Mail Transfer Protocol Work? along with Different commands in SMTP. You may also have a look at the following articles to learn more –