SMTP or Simple Mail Transfer Protocol is a way to transfer email
reliably and efficiently. SMTP is a relatively simple, text-based
protocol, where one or more recipients of a message are specified
(and in most cases verified to exist) and then the message text
is transferred. You can think of SMTP as the language that mail
servers use to communicate among themselves.
is used to send mail to the recipient's mailbox. The recipient may
use various methods to access the emails in his mailbox. A couple
of methods that are very popular are POP3 and IMAP. These protocols
allow a user to access his messages stored on a remote mail server.
When the user wants to send a message to someone, the sender-SMTP
establishes a two-way transmission channel to a receiver-SMTP. SMTP
commands are generated by the sender-SMTP and sent to the receiver-SMTP.
SMTP replies are sent from the receiver-SMTP to the sender-SMTP
in response to the commands. In case a direct connection does not
exist between the sender and the final destination, the message
may be sent via one or more relay SMTP-servers. The relay SMTP-servers
first act as receivers and then relays the message to the next SMTP.
To be able to provide the relay capability the SMTP-server must
be supplied with the name of the ultimate destination host as well
as the destination mailbox name.
Once the transmission channel is established, the SMTP-sender sends
a MAIL command indicating the sender of the mail. If the SMTP-receiver
can accept mail it responds with an OK reply. The SMTP-sender then
sends a RCPT command identifying a recipient of the mail. If the
SMTP-receiver can accept mail for that recipient it responds with
an OK reply; if not, it responds with a reply rejecting that recipient
(but not the whole mail transaction). The SMTP-sender and SMTP-receiver
may negotiate several recipients. When the recipients have been
negotiated the SMTP-sender sends the mail data, terminating with
a special sequence. If the SMTP-receiver successfully processes
the mail data it responds with an OK reply. The dialog is purposely