
27
What is Simple Mail Transfer Protocol (SMTP)?
Just like other network protocols, SMTP allows computers and servers to exchange data regardless of the underlying hardware or software.
What is Simple Mail Transfer Protocol (SMTP)?
Hello again! If you search within the tools on SProblemes.com, you will find an online SMTP test tool. Here, you'll learn everything you need to know about the Simple Mail Transfer Protocol (SMTP), which is a technical standard for sending email over the network.
Just like other network protocols, SMTP allows computers and servers to exchange data regardless of the underlying hardware or software. Just as using a standardized envelope addressing model allows the postal service to function, SMTP standardizes the way email moves from sender to recipient, making large-scale email delivery possible.
SMTP is a mail delivery protocol, not a mail retrieval protocol.
The postal service delivers mail to a mailbox, but the recipient still needs to retrieve the mail from the mailbox. Similarly, SMTP delivers email to a mail server of the email provider, but separate protocols are used to retrieve that email from the mail server so the recipient can read it.
How does SMTP work?
All network protocols follow a predefined process for exchanging data. SMTP defines the process of data exchange between an email client and a mail server. The email client is what the user interacts with: the computer or web application through which emails are accessed and sent. The mail server is a specialized computer for sending, receiving, and forwarding emails; users do not interact directly with mail servers.
Here is a summary of what occurs between an email client and a mail server to start sending an email:
- SMTP connection is opened: Since SMTP uses the Transmission Control Protocol (TCP) as its transport protocol, this first step begins with a TCP connection between the client and the server. Then, the email client starts the email sending process using a specialized "Hello" command (HELO or EHLO, described below).
- Transfer of email data : The client sends the server a series of commands accompanied by the actual email content: the email header (including destination and subject line), the email body, and any attachments.
- Mail Transfer Agent (MTA): The server runs a program called the Mail Transfer Agent (MTA). The MTA verifies the domain of the recipient's email address and, if it differs from the sender's address, queries the Domain Name System (DNS) to find the recipient's IP address. This is similar to a post office looking up the zip code for the mail recipient.
- Connection is closed:The client notifies the server when data transfer is complete, and the server closes the connection. At this point, the server will not receive additional email data from the client unless the client opens a new SMTP connection.
Typically, this first mail server is not the actual final destination for the email. The server, after receiving the email from the client, repeats the SMTP connection process with another mail server. The second server does the same, until the email eventually reaches the recipient's inbox on a mail server controlled by the recipient's email provider.
What is an SMTP Envelope?
An "SMTP envelope" is the set of information that the email client sends to the mail server about the source of the email and where it is headed. The SMTP envelope is different from the email's address and body and is not visible to the email recipient.
What are SMTP Commands?
SMTP commands are predefined text instructions that tell the client or server what to do and how to handle any accompanying data. Think of them as buttons the client can press to ensure the server accepts the data correctly.
- HELO/EHLO: These commands say "hello" and start the SMTP connection between the client and the server. "HELO" is the basic version of this command; "EHLO" is for a specialized type of SMTP.
- MAIL FROM: This tells the server who is sending the email. For instance, if Alice is trying to send an email to her friend Bob, the client might send “MAIL FROM: <alice@example.com>”.
- RCPT TO: This command lists the email recipients. The client can send this command multiple times if there are several recipients. In the example above, Alice’s email client sends “RCPT TO: <bob@example.com>”.
- DATA: This precedes the email content.
- RSET: This command resets the connection, clearing all previously transmitted information without closing the SMTP connection. It is used if the client sent incorrect information.
- QUIT: This ends the connection.
What is an SMTP Server?
An SMTP server is a mail server that can send and receive emails using the SMTP protocol. Email clients connect directly to the SMTP server of the email provider to start sending an email. Several different programs operate on an SMTP server:
Mail Submission Agent (MSA): Receives emails from the email client.
Mail Transfer Agent (MTA): Transfers emails to the next server in the delivery chain. As described above, it may query the DNS to find the Mail Exchanger (MX) record of the recipient's domain if needed.
Mail Delivery Agent (MDA): Receives emails from MTAs and stores them in the recipient's email mailbox.
What port does SMTP use?
In networking, a port is the default point where network data is received; think of it as the apartment number in a mailing address. Ports help computers sort network data to the right applications. Network security measures, such as firewalls, can block unnecessary ports to prevent the transmission and reception of malicious data.
Historically, SMTP only used port 25. Today, port 25 is still used for SMTP, but it can also use ports 465, 587, and 2525.
- Port 25 is most commonly used for communications between SMTP servers. Today, end-user network firewalls often block this port because spammers try to misuse it to send large volumes of spam.
- Port 465 was once designated for use by SMTP with Secure Sockets Layer (SSL) encryption. But SSL has been replaced by Transport Layer Security (TLS), so modern email systems no longer use this port. It only appears in legacy systems.
- Port 587 is now the default port for sending email. SMTP connections over this port use TLS encryption.
- Port 2525 is not officially associated with SMTP, but some email services offer SMTP delivery over this port if the above-mentioned ports are blocked.
SMTP vs. IMAP and POP
The Internet Message Access Protocol (IMAP) and Post Office Protocol (POP) are used to deliver email to its final destination. The email client must retrieve email from the final mail server in the chain to display the email to the user. The client uses IMAP or POP instead of SMTP for this purpose.
To understand the difference between SMTP and IMAP/POP, consider the difference between a wooden plank and a rope. A piece of wood can be used to push something forward but not pull it in. A rope can pull an item but cannot push it. Similarly, SMTP "pushes" email to a mail server, while IMAP and POP "pull" it the rest of the way to the user application.
What is Extended SMTP (ESMTP)?
Extended SMTP (ESMTP) is a version of the protocol that expands its original capabilities, enabling the sending of email attachments, using TLS, and other features. Almost all email clients and services use ESMTP, not basic SMTP.
ESMTP has some additional commands, including "EHLO," an “extended hello” message that enables the use of ESMTP at the start of the connection.
Contact
Missing something?
Feel free to request missing tools or give some feedback using our contact form.
Contact Us