SMTP (Simple Mail Transfer Protocol) . Simple Mail Transfer Protocol is an application layer protocol. Text-based network protocol used for the exchange of e-mail messages between computers or other devices (PDA’s, mobile phones , etc.). It is defined in RFC 2821 and is an official Internet standard .
Summary
[ hide ]
- 1 History
- 2 Operation
- 1 Basic SMTP commands
- 2 Example of a communication
- 3 Specifications
- 1 Connection at the beginning of the protocol
- 2 Sending messages
- 2.1 Sending the envelope
- 2.2 Sending the message content
- 3 Closing the connection
- 4 See also
- 5 External Links
- 6 Sources
History
It is part of the electronic messaging that were used in the 60’s. As more computers began to be interconnected with others, especially in the United States government ARPANET, standards were developed to allow users who used different systems to use the email each other. SMTP grew out of these standards developed during the 1970s.
SMTP can trace its roots to the mailbox protocol (ca. 1971 ), FTP mail (ca. 1973 ), and mail protocol. Work continued through the 1970s, until the ARPANET turned it into the modern Internet around 1980 . Jon Postel then proposed a Mail Transfer Protocol in 1980 which began to remove the trust from the mail on FTP. SMTP was published as RFC 821 in August of 1982 , also by Jonathan Postel .
The SMTP standard was developed around the same time the USENET were, one-to-many communications networks with some similarities.
SMTP became widely used in the mid-1980s. At the time, it was a complement to UUCP (Unix to Unix Copy) mail, which was better suited for handling e-mail transfers between machines that were connected intermittently. SMTP, on the other hand, works best when the sending and receiving machines are connected to the network all the time. Both use the warehouse and forward mechanism and are examples of push technology.
Functioning
SMTP is based on the client-server model, where a client sends a message to one or more recipients. Communication between the client and the server consists entirely of lines of text made up of ASCII characters . The maximum size allowed for these lines is 1000 characters.
Server responses consist of a three-digit numeric code, followed by explanatory text. The number is directed to an automatic processing of the answer by automaton, while the text allows a human to interpret the answer. In the SMTP protocol all commands, replicas or data are lines of text, delimited by the <CRLF> character. All replicas have a numeric code at the beginning of the line.
In the TCP / IP suite of protocols , SMTP overrides TCP, typically using port 25 on the server to establish the connection.
Basic SMTP commands
- HELO, to open a session with the server
- MAIL FROM, to indicate who sends the message
- RCPT TO, to indicate the recipient of the message
- DATA, to indicate the beginning of the message, it will end when there is a line with only a point.
- QUIT, to close the session
- RSET Aborts the current transaction and clears all records.
- SEND Starts a transaction in which the message is delivered to a terminal.
- SOML The message is delivered to a terminal or mailbox.
- SAML The message is delivered to a terminal and a mailbox.
- VRFY Asks the server to verify the argument.
- EXPN Asks the server to confirm the argument.
- HELP Allows you to request information about a command.
- NOOP Used to reset the timers.
- TURN Requests the server to exchange the packets.
Example of a communication
First, a connection must be established between the sender (client) and the receiver (server). This can be done automatically with a mail client program or through a Telnet client .
The following example shows a typical connection. The client is named with the letter C and the server with S.
S: 220 ESMTP Server C: HELO mycomputer.mydomain.com S: 250 Hello, please meet you C: MAIL FROM: S: 250 Ok C: RCPT TO: S: 250 Ok C: DATA S: 354 End data with <CR > <LF>. <CR> <LF> C: Subject: Subject field C: From: C: To: C: C: Hello, C: This is a test. C: Bye. C: C:. S: 250 Ok: queued as 12345 C: quit S: 221 Bye
specs
SMTP message transfer example :
The lines preceded by << “C:” >> correspond to commands issued by the client and those that begin with << “S:” >> are the consequent responses that the server returns. S: <waiting for TCP connection on port 25> c: <opens connection to server> s: 220 beta.gov Simple Mail Transfer Service ready c: HELO s: 250 beta.gov c: MAIL from: s: 250 OK c: RCPT TO: s: 250 OK c: RCPT TO: s: 550 No such user here c: DATA s: 354 Start of mail input; ends with <CRLF>. <CRLF> c: …. the content of the message is sent (header and body) … c: <CRLF>. <CRLF> s: 250 OK c: QUIT s: 221 beta. gov Service closing transmition channel
Connection at protocol start
When the TCP protocol is used, the SMTP server listens permanently to port 25, waiting for a client to send it. The SMTP application protocol starts the HELO command, followed by the identification of the client, the server accepts it with a code << 250 OK >>.
Sending messages
Once the protocol has started, messages are sent from the client to the server, through the following process.
Sending the envelope
First, the mailbox address of the origin of the message is transmitted, the command is MAIL FROM and if the server accepts it sends the message 250 OK. Then the destination address is transmitted, using the RCPT TO command and the server confirms with 250 OK, but if the recipient does not exist, 550 Failure is sent.
Sending the message content
The client informs the server that it is going to send the message by means of the DATA command, if the server is willing to send 354, all the lines that the client sends from this moment on are considered part of the message content, at the end of the message they are consider sending the <<. >>, when the server receives the end of the message it confirms with 250 OK,
Closing the connection
Once all the messages have been sent, the client can close the connection using the QUIT command, otherwise the machine that received the messages is the one who sends them with the TURN command, the server confirms with 250 OK, giving a section that starts with the HELO command.




