Skip to content
General

SMTP (Simple Mail Transfer Protocol)

SMTP is the protocol that moves email between servers: a text conversation of commands and reply codes. The transaction, the ports, and the extensions that matter.

SMTP (Simple Mail Transfer Protocol) is the protocol email travels over: a line-based text conversation in which the sending server introduces itself, states the envelope sender and recipients, transmits the message, and reads a three-digit reply code after every step. Designed in 1982 and extended ever since, it remains deliberately simple, which is both why email interoperates globally and why everything about trust, authentication, alignment, transport security, had to be layered on top.

The transaction, end to end

A minimal SMTP session
1< 220 mx.example.org ESMTP ready
2> EHLO mail.example.com
3< 250-mx.example.org options follow
4< 250-STARTTLS
5< 250 SIZE 52428800
6> STARTTLS            (session upgrades to TLS, EHLO repeats)
7> MAIL FROM:<bounce@example.com>
8< 250 OK
9> RCPT TO:<user@example.org>
10< 250 OK
11> DATA
12< 354 Send message, end with .
13> ...headers and body...
14> .
15< 250 OK: queued as 8C1A2B
16> QUIT

Two structural facts in that exchange drive most of email authentication. The envelope (MAIL FROM, RCPT TO) is separate from the message content, so the address a recipient sees in From: is not what the transaction declared, which is the gap SPF, DKIM, and DMARC exist to close. And the reply codes (2xx success, 4xx temporary failure, 5xx permanent failure, refined by enhanced status codes) are the entire feedback vocabulary of delivery: bounces, deferrals, and greylisting are all just these codes in context.

Ports and roles

Port 25 is server-to-server transport, and consumer networks block it outbound to stop malware from spamming directly. Port 587 is the submission port, where authenticated clients and applications hand mail to their own MTA, secured with STARTTLS. Port 465 is submission over implicit TLS, equally standard today. The practical rule: applications submit on 587 or 465 with credentials; only MTAs talk to strangers on 25.

The extensions that modernized it

ESMTP (the EHLO greeting) lets servers advertise capabilities, and the ones that matter daily: STARTTLS upgrades the session to encryption, with MTA-STS and DANE layering enforcement on top of its opportunism; SIZE declares message limits; PIPELINING batches commands for throughput; SMTPUTF8 enables internationalized addresses; and AUTH carries the credentials on submission ports. The protocol's genius is that a 1982 server and a 2026 server can still talk, negotiating everything newer only when both sides support it.

Frequently asked questions

Is SMTP used for receiving mail too?
SMTP moves mail between servers in both directions, but retrieving mail from your mailbox to your client uses different protocols: IMAP or POP3. SMTP delivers to the mailbox; IMAP reads from it.
Is SMTP encrypted?
Optionally, via STARTTLS, and opportunistically by default: sessions fall back to plaintext when negotiation fails unless MTA-STS or DANE enforces otherwise. Submission ports (587/465) require TLS in any sane configuration.
Why does such an old protocol still run everything?
Universal interoperability compounds: every mail system on earth speaks it, and the extension mechanism lets capability grow without breaking anyone. The trust problems the 1982 design ignored were solved beside it, in SPF, DKIM, DMARC, and the transport policies, rather than by replacing it.

Key takeaways

  • SMTP is a text conversation: envelope first (MAIL FROM, RCPT TO), then content, with reply codes at every step
  • The envelope/content split is the structural gap that SPF, DKIM, and DMARC exist to close
  • Port 25 is server transport, 587 and 465 are authenticated submission; applications never speak raw 25
  • ESMTP extensions (STARTTLS, SMTPUTF8, AUTH, SIZE) modernized the protocol without breaking 40 years of interoperability