How email works: SMTP, IMAP and POP3 explained
What happens between pressing send and the message arriving — servers, protocols, and why IMAP beat POP3.
On this page
Email looks instant, but the message actually travels through several servers using different protocols. This article walks through the journey of one email.
The big picture: three protocols
Email uses three protocols, each with a job:
- SMTP — sending. Moves messages between mail servers, and from your device to your server.
- IMAP — reading and managing messages on the server. Your devices stay in sync.
- POP3 — older way to read: downloads messages and removes them from the server.
The journey of a message
You write to friend@example.com and press send:
- Your email app talks SMTP to your provider's server (say, your Gmail or Outlook server). It hands over the message: envelope (sender, recipient), headers, body.
- Your server looks up the destination. It does an MX (mail exchange) lookup for
example.com— DNS tells it which server accepts mail for that domain. - The servers talk SMTP. Your server connects to the destination's mail server and hands the message over. Servers retry if the destination is temporarily unavailable — that is why email rarely fails permanently; it queues.
- The destination server delivers to a mailbox — a store on disk.
- Your friend reads it — their app uses IMAP to fetch and display the message, keeping it on the server.
SMTP details
SMTP is a simple text protocol: the client sends commands like MAIL FROM, RCPT TO, DATA, and the server replies with status codes. Encryption came later — modern SMTP uses STARTTLS to encrypt the connection between servers. Note: SMTP historically only guarantees delivery to the mailbox, not encryption of the content — that is why end-to-end encryption (S/MIME or PGP) remains a separate layer.
IMAP versus POP3 — why IMAP won
- POP3 downloads mail to one device. A message read on your laptop is gone from the server — your phone will not see it. Very limited for multiple devices.
- IMAP keeps everything on the server. Folders, read flags, drafts stay in sync across all devices. That is why IMAP is the default in modern email apps.
Spam and security
Because SMTP is easy to abuse, extra checks were added:
- SPF — the domain declares which servers may send its mail.
- DKIM — the sending server digitally signs messages.
- DMARC — tells receiving servers what to do when SPF/DKIM fail.
These are published as DNS records. They do not stop every spam message, but they make forging a domain much harder.
FAQ
What does SMTP do?
SMTP (Simple Mail Transfer Protocol) moves messages between mail servers and from your device to your server. It is a simple text protocol: the client sends commands like MAIL FROM, RCPT TO and DATA, and the server replies with status codes. Modern SMTP uses STARTTLS to encrypt the connection between servers.
What is the difference between IMAP and POP3?
POP3 downloads mail to one device and removes it from the server — a message read on your laptop will not appear on your phone. IMAP keeps everything on the server, so folders, read flags and drafts stay in sync across all devices. That is why IMAP is the default in modern email apps.
Why can email delivery take a few minutes?
Because mail servers retry when the destination is temporarily unavailable. Your server connects to the destination's mail server and hands the message over; if the destination cannot be reached, the message is queued and delivery is attempted again. That is why email rarely fails permanently.
What are SPF, DKIM and DMARC?
They are DNS-based checks against email forgery. SPF declares which servers may send mail for a domain. DKIM makes the sending server digitally sign messages. DMARC tells receiving servers what to do when SPF or DKIM fail. They do not stop every spam message, but they make forging a domain much harder.
Summary
Email is moved by SMTP between servers, stored in mailboxes, and read with IMAP (or POP3 on old setups). DNS decides where mail for a domain goes, and SPF/DKIM/DMARC protect against forgery. The next time you send a message, it silently travels through at least two or three servers to reach its mailbox.
Sources
- RFC 5321 — Simple Mail Transfer Protocol (ietf.org/rfc/rfc5321)
- Cloudflare Learning Center — What is SMTP? (cloudflare.com/learning/email-security/what-is-smtp)
Share this guide
Related guides
- How to configure DNS records: A, AAAA, CNAME, MX, and TXT explained
Configure DNS records for your domain: learn what A, AAAA, CNAME, MX, and TXT records do, when to use each, and how to verify your changes propagate correctly.
- What is a browser cache? How it speeds up websites
Where your browser stores copies of images, scripts and fonts, why cached pages load faster, and how to clear the cache or force a fresh copy.
- How browser cookies work: a plain guide
What cookies are, how session and tracking cookies differ, and what 'accept all cookies' actually means.