SMTP — Simple Mail Transfer Protocol

Jon SY Chan
4 min readOct 18, 2019

--

One of our most common forms of communication is email. This blog will be a dive into how that works. One thing the emailing system follows is the Simple Mail Transfer Protocol or SMTP, a connection-oriented text-based protocol. The internet is set up in protocols in order to link up networks everywhere and transfer information. SMTP is just one piece in how we send and receive email and is an internet standard that was defined in 1982.

SMTP is part of the application layer of the TCP/IP protocol. Using a process called “store and forward,” SMTP moves your email on and across networks. It works closely with something called the Mail Transfer Agent (MTA) to send your communication to the right computer and email inbox.

https://whatismyipaddress.com/smtp

A great overview can be explained in TECHNOPHILE’s video below:

A MTA (like a mail relay) checks the domain’s MX record, a resource record in the DNS to decide how to continue transferring the message either to another MTA or MDA (Mail Delivery Agent).

https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

A MDA (Mail Delivery Agent) is a software that stores messages for batch retrieval on the MUA (Mail User Agent ex- apple mail, outlook express) side.

SMTP is mainly focused with the push protocol in order to send emails from one server to another, usually the mail server (gmail server, yahoo server). Since it is usually limited in its ability to queue messages on the receiving end, other protocols like POP3 (handles one server but many emails) and IMAP (handles multi-server or multiple devices) are used to retrieve and handle these emails on the MUA (email client: apple mail, outlook, web mail sites like gmail and yahoo) from the server mailbox.

https://www.socketlabs.com/blog/smtp-or-imap/

THE 6 MAIN STEPS of SMTP (protocol)

1. Email is submitted by a MUA to a mail server’s MSA (message submission agent)

2. The message is transferred to the server’s MTA (the MTA and MSA are usually hosted on the same SMTP server)

3. The MTA checks the MX record of the recipient domain and transfers the message to another MTA (this step can occur multiple times until the message is received by the proper receiving server)

4. The message is handed off to the MDA, which saves messages in the proper format for retrieval by the receiving MUA

5. The receiving MUA requests the message from the MDA (usually with POP3 or IMAP)

6. The message is delivered to the receiving MUA‘s inbox

https://blog.sendinblue.com/what-is-smtp-server/

https://en.wikipedia.org/wiki/Message_transfer_agent

When referring to SMTP it should be noted that it may be referred in different ways such as the SMTP (protocol), SMTP relay and the SMTP server.

A SMTP server has a program running that waits for SMTP commands from the sender. It sets up connections with the sender and routes messages to the proper recipient.

SMTP servers also commonly uses TCP on port 25. Email Message Submission is often sent on port 587.

A basic look into the actual commands and SMTP conversation that occurs during the protocol can be found on the DMARC website.

SMTP is used to deliver email between servers when a piece of email needs to travel across the Internet. The handoff of email between two different servers is what SMTP accomplishes, and SMTP does this using a very conversational set of commands. That is, servers talk to each other, exchange bits of information about themselves, they exchange bits of information about the email that will be handed over, and then the actual piece of email is communicated to the receiving server. This back and forth is referred to as the SMTP conversation.

https://dmarcian.com/video-smtp-overview/

SMTP was also updated to ESMTP in 2008 which have added enhancements like better security, authentication and etc.

--

--