Markdown

SMTP

SMTP is the Acronym for Simple Mail Transfer Protocol

The standard communication protocol used to send an electronic mail (email) across IP networks. While protocols like IMAP or POP3 are responsible for receiving and storing mail, SMTP is the delivery vehicle that moves messages from the sender’s client to the recipient’s mail server.

SMTP Specifications

  • Function: Outgoing mail transfer.
  • Default Ports: * 25: The original, non-encrypted port (mostly used for server-to-server relay).
    • 465: SMTPS (SMTP over SSL/TLS).
    • 587: The modern standard for secure mail submission (using STARTTLS).
  • Model: Client-Server.

How the SMTP Process Works

SMTP works through a series of commands and responses between two servers:

  1. Handshake: The sender’s client (e.g., Outlook or Gmail) connects to the SMTP server and says HELO or EHLO.
  2. Sender/Recipient Info: The client provides the sender’s address (MAIL FROM:) and the recipient’s address (RCPT TO:).
  3. Data Transfer: The client sends the DATA command, followed by the actual body of the email, headers, and attachments.
  4. Handoff: If the recipient is on a different network, the sender’s SMTP server looks up the MX (Mail Exchanger) record in the DNS to find the recipient’s server and forwards the mail.
  5. Termination: Once the transfer is confirmed with a 250 OK code, the connection is closed using QUIT.

SMTP vs. IMAP/POP3

ProtocolDirectionPrimary Purpose
SMTPPush (Outgoing)Sends email from a client to a server or between servers.
IMAPPull (Incoming)Syncs mail between the server and multiple devices.
POP3Pull (Incoming)Downloads mail from the server to a single device (often deleting it from the server).

Common SMTP Response Codes

If you have ever received a Bounce Back email, it likely contains one of these SMTP status codes:

  • 250: Requested mail action okay, completed (Success).
  • 421: Service not available, closing transmission channel (Temporary failure).
  • 450: Requested mail action not taken: mailbox unavailable (e.g., busy).
  • 550: Requested action not taken: mailbox unavailable (e.g., address doesn’t exist).

The Security Problem: Spoofing

Originally, SMTP did not require authentication, which allowed anyone to send mail from any address—leading to the explosion of Spam. To combat this, three modern “safety layers” are now used alongside SMTP:

  1. SPF (Sender Policy Framework): Lists which IP addresses are allowed to send mail for a domain.
  2. DKIM (DomainKeys Identified Mail): Adds a digital signature to the email header.
  3. DMARC: Tells the receiving server what to do if SPF or DKIM fails (e.g., Reject it or Quarantine it).

Articles Tagged SMTP

View Additional Articles Tagged SMTP