Vol. I · No. 46The protocol sectionSat, 10 Oct 2026
Layer 7 · Mail · the mailbox stays on the server

IMAP

Internet Message Access Protocol

IMAP is how you read mail that never leaves the server. Rather than downloading a message and owning it, a client browses folders and fetches only the parts it needs, and every flag and folder change is stored centrally — so phone, laptop and webmail all show the same mailbox.

IMAP keeps the mailbox on the server and synchronises state — which is why reading a message on your phone marks it read everywhere.

Operates at
Layer 7
a text command dialog
Ports
993 · 143
TLS · STARTTLS
Model
Server-side
folders and flags
Fetches
Selectively
headers, or one part

How it works

Browsing a mailbox you never actually download
Mail clientIMAP server
Log in and pick a folder
a1 LOGIN anna … → a2 SELECT INBOX
The server reports how many messages exist and which are unseen
Fetch only what is needed to draw the list
a3 FETCH 1:50 (FLAGS ENVELOPE)
Subjects, senders and flags — the bodies stay on the server until opened
State changes are stored centrally
a4 STORE 7 +FLAGS (\Seen) — and every other device sees it read

Because the server holds the truth, clients are caches rather than owners. IDLE keeps the connection open so the server can push news of a new message instead of being polled.

The main points

What IMAP does, step by step

1
Connect and authenticate

The client opens a TLS connection to 993 and logs in — or upgrades port 143 with STARTTLS.

2
Select a mailbox

SELECT or EXAMINE opens a folder and reports its message count, unseen count and validity.

3
Fetch what you need

Envelopes and flags to draw the list; a single MIME part when the user actually opens something.

4
Change state on the server

Flags, moves and deletions are STORE and COPY commands — every client sees the same result.

Things it does that POP3 can’t
Server folders — a real hierarchy, synced
Shared flags — read state across devices
Partial fetch — one attachment, not the mail
Server-side search — no download to find things
IDLE — push instead of polling
Multiple clients — all consistent at once

In cybersecurity

IMAP is a standing door to everything a person has ever written — and because clients stay logged in for months, a stolen credential is rarely noticed quickly.

Always implicit TLS

Port 993 from the start; plain 143 without STARTTLS puts the password on the wire.

Legacy auth bypasses MFA

Basic IMAP login predates it — disable it, or one password is the whole account.

App passwords leak

Long-lived per-client secrets are rarely rotated and often stored in plain text.

Silent mailbox rules

An intruder’s forwarding or auto-delete rule quietly exfiltrates mail for months.

Full-history exposure

Unlike POP3, a compromise reaches the entire archive, not just what is undownloaded.

OAuth instead

Modern clients use a token that can be scoped and revoked without changing the password.

Rides in the stack

IPTCPTLSIMAP

A long-lived TCP session — often held open for hours with IDLE so new mail can be pushed rather than polled.

Works with

SMTPPOP3

IMAP or POP3?

POP3IMAP
Mail livesOn the deviceOn the server
FoldersInbox onlyFull hierarchy
Many devicesPoorlyBy design
OfflineNaturallyNeeds a cache