SMTP: The Protocol Behind Email Delivery

What is SMTP?

Simple Mail Transfer Protocol (SMTP) is the backbone of email communication across the internet. It's the standard protocol that enables the transfer of emails between different servers and computer networks.

Email Delivery Flow

Sender
User's Device
MSA/MTA
Sending Server
Internet
MTA/MDA
Receiving Server
Recipient
User's Device

User composes email in MUA (Mail User Agent)

Step 1 of 8
Speed: medium

SMTP in Simple Terms

Think of SMTP as the postal service of the internet. When you send an email:

  • Your email client (like Gmail or Outlook) connects to an SMTP server
  • The SMTP server receives your message and determines how to route it
  • The message is transferred across the internet to the recipient's mail server
  • The recipient's mail server delivers the message to their inbox

Just like postal workers follow specific procedures to sort, route, and deliver physical mail, SMTP servers follow standardized commands and responses to handle email delivery.

SMTP Components

  • MUA (Mail User Agent): Your email client application
  • MSA (Mail Submission Agent): Receives emails from clients and verifies addresses
  • MTA (Mail Transfer Agent): Processes and transfers emails between servers
  • MDA (Mail Delivery Agent): Delivers emails to the recipient's mailbox

Types of SMTP

  • Originating SMTP: Introduces mail to the internet
  • Delivery SMTP: Receives emails from the internet for delivery
  • Relay SMTP: Transfers emails between servers without modification
  • Gateway SMTP: Transfers emails and can transform messages if needed

SMTP Extensions

ESMTP (Extended SMTP)
Enhances the original SMTP with additional features and capabilities. It uses the EHLO command instead of HELO to initiate connections and supports additional parameters.

SMTPS (SMTP Secure)
Secures SMTP communication using TLS (Transport Layer Security) or SSL (Secure Sockets Layer) protocols to encrypt messages during transmission.

SMTP-AUTH
Adds authentication to SMTP, requiring mail clients to log in with username and password before sending emails. This helps prevent unauthorized use of mail servers.

How SMTP Works: The Conversation

SMTP operates through a series of commands and responses between servers, similar to a conversation:

Client: HELO example.com

Server: 250 Hello example.com, pleased to meet you

Client: MAIL FROM: <sender@example.com>

Server: 250 OK

Client: RCPT TO: <recipient@example.org>

Server: 250 OK

Client: DATA

Server: 354 Start mail input; end with <CRLF>.<CRLF>

Client: [Email content...]

Client: .

Server: 250 OK

Client: QUIT

Server: 221 Bye

This structured conversation ensures reliable email delivery across different systems and networks.