SMPT
SMPT
Introduction
The actual mail transfer is done through message transfer agents (MTAs). To send mail, a system
must have the client MTA, and to receive mail, a system must have a server MTA. The formal protocol
that defines the MTA client and server in the Internet is called Simple Mail Transfer Protocol (SMTP).
As we said before, two pairs of MTA clientserver programs are used in the most common situation
(fourth scenario). SMTP is used two times, between the sender and the sender’s mail server and
between the two mail servers. As we will see shortly, another protocol is needed between the mail
server and the receiver. SMTP simply defines how commands and responses must be sent back and
forth. Each network is free to choose a software package for implementation.
Figure 1: This is an image from a text that uses color to teach music.
1
Commands and Responses
SMTP uses commands and responses to transfer messages between an MTA client and an MTA
server. Each command or reply is terminated by a two-character (carriage return and line feed) end-
of-line token.
Commands
Commands are sent from the client to the server.
Keyword: argument(s)
keyword are followed by zero or more arguments. SMTP defines 14 commands listed in Table.
Responses
Responses are sent from the server to the client. A response is a three-digit code that may be
followed by additional textual information. The idea is the same as discussed in the case of HTTP
responses.
2
Figure 4: SMTP Responses.
2. Once the connection is established, the receiver identifies itself with ”220 Service Ready”.
5. If the mail service on the destination is not available, the destination host returns a “421 Service
Not Available” reply in step 2 and the process is terminated
3
Figure 5: Connection establishment.
Mail transfer
After connection has been established between the SMTP client and server, a single message between
a sender and one or more recipients can be exchanged. This phase involves eight steps. Steps 3 and 4
are repeated if there is more than one recipient
1. The client sends the MAIL FROM message to introduce the sender of the message. It includes
the mail address of the sender (mailbox and the domain name). This step is needed to give the
server the return mail address for returning errors and reporting messages.
2. The server responds with code 250 or some other appropriate code.
3. The client sends the RCPT TO (recipient) message, which includes the mail address of the
recipient.
4. The server responds with code 250 or some other appropriate code.
5. The client sends the DATA message to initialize the message transfer.
6. The server responds code 354 (start mail input) or some other appropriate message.
7. The client sends the contents of the message in consecutive lines. Each line is terminated by a
two-character end-of-line token (carriage return and line feed).
9. The server responds with code 250 (OK) or some other appropriate code
4
Figure 6: Mail transfer.
Connection termination
After the message is transferred successfully, the client terminates the connection. This phase involes
two steps.
2. The server responds with code 221 or some other appropriate code.
3. After the connection termination phase, the Tcp connection must be closed.
References
[1]Behrouz A. Forouzan, “TCP/IP Protocol Suite”, IV Edition, McGraw Hill, 2010.
5
[2] https://en.wikipedia.org/wiki/Simple mail transfer protocol
[3] https://ecomputernotes.com/smtp-simple-mail-transfer-protocol