SMTP stands for Simple Mail Transfer Protocol, and is the basis for sending mail from one location to another on the internet. It was proposed as a standard in RFC 821 in 1982 by the late Jon Postel, and has been updated with RFC's 2821, 2822, 2920, 3030, and 2487, which extended the original specification.
Basically SMTP is an agreed, standard method in which mail servers can talk to one another, regardless of the system they are running on, and enable the transfer of emails in a reliable way.
As an example to describe how this is performed, we will say we have two users, sender@red.net and customer@hotmail.com. user@red.net wants to send a mail to customer@hotmail.com, so they open up their preferred email client. After composing the message, user@red.net clicks on the 'Send' button. The email client has no knowledge of how to send a mail directly to customer@hotmail.com, as its purpose is simply to allow a user to create and send mails, so the delivery of the mail is to be done by user@red.net's SMTP server.
At this point, the first stage of sending a mail via SMTP takes place: the email client connects to its SMTP server, (in this case we will say smtp.red.net - this is configured in the client's preferences). The email client then starts a discussion with smtp.red.net, saying what user@red.net's IP address is for logging and authenticating the email, who the mail is coming from and where it is going to. After this, the data of the message is sent. This includes information such as the date, subject, message body and any attachments that are to be sent with the email. At this point, smtp.red.net will check to ensure that it is supposed to relay the mail for the user it is coming from (this is done by checking the IP address that was given above). If it is acceptable, smtp.red.net will inform the email client that everything is OK and the message should be sent.
Now, smtp.red.net must examine the message and determine where it is supposed to be delivered to. This is determined by looking at the recipient's domain name (this is the information to the right of the '@' symbol), in this case hotmail.com. The SMTP server will look for Mail Exchanger (MX) records for this domain. MX records are a public list of servers (held in DNS) which will accept mail (via SMTP) for this domain. Once this information has been gathered, smtp.red.net will attempt to connect to hotmail.com's Mail Exchangers in order of preference. Preference is declared with MX records, with the lowest numbered MX being the most preferred exchanger. This will be discussed further later in this document.
Once smtp.red.net has connected to a hotmail.com Mail Exchanger, it declares its IP address, who the mail is from and who it is to. If the hotmail.com Mail Exchanger will accept mail for the user customer@hotmail.com, it responds that this is fine, and the message is transferred. At this time, the mail has completely left Opal's mail systems and has been successfully delivered to hotmail.com.
We have described a normal, successful session where mail is sent from one user to another on the internet, regardless of their locations. However, this is not always possible. As mentioned, Mail Exchangers have preferences with their MX records (which are stored in a DNS). The preference is a number (normally between 0-99), and declares which server is to be preferred. Take an example where there are 3 Mail Exchangers listed - mxA.red.net, mxB.red.net and mxC.red.net. They are given the preferences 0,10 and 20 respectively, and handle mail for the domain red.net.
In normal circumstances, mail sent to user@red.net should be sent to mxA.red.net. That is to say, that any remote SMTP system will want to connect to this system first, as it is the highest priority MX for the domain (the lower the number, the higher the priority). However, there are times that mxA.red.net may be down, for example, a reboot, high system load or system maintenance. In this eventuality, remote SMTP systems will then try the next MX, in our example mxB.red.net, to accept the mail. If this happens, mxB.red.net will accept the mail and attempt to send the mail to mxA.red.net on a regular basis until it has been accepted. This is known as queuing mail for delivery.


