Email Best Practices
What is an SMTP server?
Find out how works an SMTP server and understand the process. SMTP relays are a basic when it comes to sending bulk emails.
PUBLISHED ON
SMTP stands for “Simple Mail Transfer Protocol." Let’s just hope that “simple” is still the case after reading the article!
SMTP is a computer protocol or a convention that allows two computer systems to understand one another. This protocol defines how the message should be conveyed. In the same way, and for you to understand more clearly, the post office defines what information must appear on an envelope so that it arrives efficiently.
As an Internet standard, SMTP protocol is described in RFC (Request for Comments), the latest version being RFC 5321. Feel free to browse this document for your general knowledge… but beware, reading will not be very exciting for the average user; it’s quite complicated!
Table of content
A little history of SMTP
The history of electronic messaging begins in the 1960s. At that time, it was primarily an internal messaging system, developed around a mainframe (see link for definition). With the gradual interconnection of different computer systems and the development of ARPANET, several protocols were developed to allow for the sending of emails between these networks.
For several years, various protocols would be used to e-mail. It was not until the early 1980s that SMTP became essential alongside UUCP (which is still used for Usenet newsgroups today).
SMTP, more suitable for permanently connected networks, gradually took over UUCP to become the main technology used for e-mail sending.
The basic principle of SMTP relay
As mentioned above, SMTP defines the rules that govern the transportation of electronic messages (the envelope). But SMTP does not define the content of the message itself, which is the subject of another RFC, “Internet Message Format”, found under reference 5322.
When you send an email via SMTP?
There are two major phases:
1. The first is to know what the IP address (the unique identifier of a computer on the internet) of the server to contact is. This is accomplished through the DNS (Domain Name System, a directory linking a domain name and an IP address). For example, for the email address, larry@google.com, the MX record (Mail eXchange) will send back 173.194.64.26.
2. Once this information is recovered, you can connect to the SMTP server. This second step itself occurs in three consecutive commands (actually, there are more, but for simplicity’s sake, we won’t discuss them here):
MAIL: This step corresponds to the definition of information about the sender of the email, mainly referring to the “FROM:” field.
RCPT: RCPT commands are used to define information about the recipient or recipients. This is the “TO:” field that is set.
DATA: This is the command that allows the content of the message to be sent. This part is defined in RFC 5322 (Internet Message Format). When speaking of content, this signifies not only the email subject and body of the message, but also a whole range of information, present in the header of your email. For more information on this part, please read the article: How to read email headers?
What about the SMTP errors?
Between each command (MAIL, RCPT, DATA), the SMTP server gives a response called an SMTP return code. One can distinguish four types of codes, each beginning with a different number:
2xx: The command was executed successfully.
3xx: The command is being executed.
4xx: Failed to execute the command for the time being, must try again later.
5xx: The command could not be executed.
The next two digits (represented here by xx) provide more details on the exact nature of the code. In addition, a text message also accompanies the SMTP code. We will discuss these SMTP codes in more detail in a future article.
What's next?
With this article, we have only scratched the surface of the subject of SMTP, but it will suffice for the time being. The next step would be to choose your SMTP server and to understand what you should and shouldn't do with it. Go do it!