Summary
- RFC 3501, March 2003, defines IMAP4rev1: the mail stays on the server, and a phone, a laptop and a web reader can all work on the same folder at once.
- The design's central awkwardness is admitted in a single line: messages "are accessed by one of two numbers; the unique identifier or the message sequence number".
- A flag is not a field rewritten in place but "a list of zero or more named tokens associated with the message" — set by addition, cleared by removal.
Mail that stays where it is
POP3 handed the mailbox to a single client and then emptied it. IMAP leaves the mail where it is, which sounds like a storage decision and is really a much larger one: the folder stops being a file in transit and becomes a mutable object with several simultaneous readers.
The moment state is shared and mutable, every command needs a stable way to name the thing it acts on. Nearly everything strange about IMAP descends from that one requirement.
Two names, two jobs
The sequence number is a position in the currently selected folder: small, cheap to say, and rearranged the instant a message arrives or disappears. The UID is permanent for the life of the mailbox and never reused — with one escape hatch, since a mailbox that renumbers itself must also change its UIDVALIDITY value, so clients know their cache has expired.
So clients live in both worlds at once. They display by position, cache by UID, and translate in the middle — which works beautifully until one message expires and every position behind it shifts by one.
State as tokens, not documents
Marking a message read could mean rewriting a file. IMAP instead attaches flags: named tokens added and removed, stored beside the message and fetched on demand.
That is a small database design hiding inside a mail protocol. Read, unread, flagged and deleted become cheap, and the client's view becomes a cache of tokens rather than a copy of the message.
States, and commands that only sometimes apply
The protocol defines a state machine — not authenticated, authenticated, selected, logout — with a command set attached to each. A command that is valid in one state is an error in another.
That is honest about what a connection can mean, and it is why implementations must track session state precisely. Most of IMAP's reputation for complexity is the price of being stateful on purpose.
The lesson in two names
Any protocol acting on shared mutable state ends up with two identities: one for convenience, one for permanence. Keep only the convenient one and you lose track of objects. Keep only the permanent one and you lose the ability to say "the third message on screen".
The general rule is to name the object permanently, expose the convenient name, and write down exactly when the two can diverge. IMAP wrote it down — which is why, two decades on, the awkwardness reads as a documented trade rather than a mystery.
Member Briefing
Read the full trend briefing
Members read the full briefing with the source notes behind every finding.
Strategic Circle
A daily briefing in your language, built from changes we have verified.
Join for USD 20/monthCancel anytime.
Members also get the full research library, a daily briefing on the networks they follow and the private forum.






