What Is SMTP?

The Simple Mail Transfer Protocol is how every email on the internet gets sent. Here is what it is, how the conversation actually works, and why understanding it makes email problems easy to diagnose.

SMTP (Simple Mail Transfer Protocol) is the internet standard for sending email. It was defined in RFC 821 in 1982, revised as RFC 5321 in 2008, and — remarkably for a protocol designed before the web existed — it still carries essentially all email traffic today.

SMTP has exactly one job: move a message from a sender to a recipient's mail server. It does not store mail, display it, or let you read it. Those are jobs for IMAP and POP3.

How SMTP works, step by step

Sending an email involves two distinct SMTP phases that people often conflate.

Phase 1: submission (you → your provider)

Your mail client or application connects to your own provider's submission server — smtp.gmail.com, say — on port 587 or 465. This connection is authenticated: you prove who you are with a username and password before the server will accept anything. This is the phase an SMTP checker tests.

Phase 2: relay (provider → recipient)

Your provider looks up the recipient domain's MX records in DNS, finds the responsible mail server, and connects to it on port 25. This connection is not authenticated — the receiving server decides whether to accept the message based on reputation, SPF, DKIM and DMARC. This is why port 25 cannot be used for submission and why domain authentication matters so much.

The SMTP conversation

An SMTP session is plain text, which makes it easy to read. Here is a complete authenticated submission, with server replies prefixed by their reply codes:

$ openssl s_client -starttls smtp -connect smtp.example.com:587

220 smtp.example.com ESMTP ready          <- server greeting
EHLO client.example.org                    -> introduce ourselves
250-smtp.example.com
250-STARTTLS
250-AUTH LOGIN PLAIN
250 SIZE 35882577                          <- supported extensions
AUTH LOGIN                                 -> begin authentication
334 VXNlcm5hbWU6                           <- "Username:" in base64
dXNlckBleGFtcGxlLmNvbQ==                   -> our username, base64
334 UGFzc3dvcmQ6                           <- "Password:" in base64
YXBwLXBhc3N3b3Jk                           -> our password, base64
235 2.7.0 Authentication successful        <- logged in
MAIL FROM:<[email protected]>               -> envelope sender
250 2.1.0 OK
RCPT TO:<[email protected]>                -> envelope recipient
250 2.1.5 OK
DATA                                       -> start the message
354 Start mail input, end with <CRLF>.<CRLF>
Subject: Hello
From: [email protected]
To: [email protected]

This is the message body.
.                                          -> a lone dot ends it
250 2.0.0 OK: queued as 4A2B1C             <- accepted
QUIT
221 2.0.0 Bye

Every failure you will ever debug happens at one of those steps, and the server tells you which. No 220 greeting means a blocked port. A failure after AUTH LOGIN means bad credentials. A rejection at RCPT TO means the recipient was refused. A rejection after DATA means a content or policy filter caught it.

Core SMTP commands

CommandPurpose
EHLOIntroduces the client and asks the server to list its supported extensions. The modern replacement for HELO.
STARTTLSUpgrades the plaintext connection to TLS. Must be issued before AUTH on port 587.
AUTHAuthenticates the client, usually with LOGIN or PLAIN over an encrypted connection.
MAIL FROMDeclares the envelope sender — the address bounces return to. Not necessarily the visible From header.
RCPT TODeclares one recipient. Repeated once per recipient.
DATABegins the message headers and body, terminated by a line containing only a period.
RSETAborts the current transaction without closing the connection.
QUITCloses the session cleanly.

SMTP vs IMAP vs POP3

These three protocols are routinely confused. They do entirely different things:

SMTPIMAPPOP3
DirectionSendingReceivingReceiving
Typical ports587, 465, 25993 (TLS), 143995 (TLS), 110
Mail stays on serverN/AYesUsually deleted
Multi-device syncN/AYesNo
Best forAll outgoing mailModern multi-device useSingle device, offline archive

A practical consequence: if you can receive mail but not send it, SMTP is at fault and IMAP is fine. If you can send but not receive, the reverse. Testing them separately is the fastest way to narrow down an email problem.

SMTP ports in brief

Port 587 with STARTTLS is the standard for authenticated submission and the one you should reach for first. Port 465 with implicit SSL/TLS is an equally valid alternative. Port 25 is for server-to-server relay and is blocked by nearly every ISP and cloud provider. Port 2525 is an unofficial fallback offered by transactional relays.

The full SMTP ports guide covers each in depth.

What SMTP does not do

Understanding SMTP's limits explains most email mysteries:

  • It does not verify the sender. Anyone can put any address in MAIL FROM. That is precisely why SPF, DKIM and DMARC had to be invented.
  • It does not guarantee inbox placement. A 250 reply means accepted, not delivered. Spam filtering happens after acceptance.
  • It does not encrypt at rest. TLS protects the message in transit between hops; the content sits unencrypted on each server it passes through.
  • It does not confirm reading. Read receipts are an optional header the recipient's client can ignore entirely.
  • It does not retry forever. Queued mail after a 4xx is typically retried for a few days, then bounced.

How to test SMTP

The quickest route is the free SMTP checker — enter your host, port and credentials and it runs the entire conversation above, reporting the server's own replies. For hands-on debugging, openssl s_client lets you type the commands yourself and watch each reply arrive.

Either way, the goal is the same: find out which step fails, and the reply code will tell you why. Our SMTP error code reference decodes every one.

Frequently asked questions

SMTP stands for Simple Mail Transfer Protocol. It is the internet standard for sending email, first defined in RFC 821 in 1982 and updated by RFC 5321 in 2008. Every email sent on the internet travels over SMTP at some point in its journey.

An SMTP server is a computer running mail transfer software — Postfix, Exim, Microsoft Exchange or a provider's own platform — that listens for SMTP connections, accepts messages and forwards them towards the recipient. When you configure smtp.gmail.com in a mail client, you are pointing it at Google's SMTP server.

SMTP sends mail; IMAP reads it. They are separate protocols on separate ports with separate servers. SMTP pushes a message from your client out to the world. IMAP connects to your mailbox and syncs messages, folders and read status across devices. A broken SMTP configuration stops you sending but not receiving, and vice versa.

SMTP itself transmits in plaintext — security comes from wrapping it in TLS. Modern submission uses STARTTLS on port 587 or implicit TLS on port 465, both of which encrypt credentials and message content in transit. Mail is not encrypted at rest on the servers it passes through, which is why end-to-end systems like PGP exist on top of SMTP.

The core set is small: EHLO (introduce the client and list extensions), STARTTLS (upgrade to an encrypted connection), AUTH (authenticate), MAIL FROM (declare the envelope sender), RCPT TO (declare each recipient), DATA (transmit headers and body) and QUIT (close the session).

An SMTP server hosts mailboxes and handles mail for its own domain. An SMTP relay accepts mail from your application and delivers it on your behalf without hosting a mailbox for you — SendGrid, Mailgun, Amazon SES and Postmark are relays. Relays manage IP reputation, bounce handling and volume in ways a single mailbox cannot.

Applications do not deliver email themselves. A WordPress site, Laravel app or Python script hands the message to an SMTP server, which does the actual delivery. The SMTP settings are the address and credentials of that server. Without them, most frameworks fall back to the local sendmail binary, which on a typical cloud server is either absent or blocked.