Understanding IMAP
Work with server-side mailboxes, tagged commands, flags and selective fetches. IMAP supports a mailbox shared across several devices.
- Default port
- 143 / 993 implicit TLS
- Transport / carrier
- TCP
- Category
- application
What to look for in the lab
Find UID 42 in the header fetch and the later flag update. BODY.PEEK requests the header without marking the message read. The later STORE command explicitly adds the read flag to that same message.
1. Authenticate securely
An IMAP session starts with a server greeting. The lab uses synthetic LOGIN data to expose syntax; real authentication needs TLS.
2. Select a mailbox
SELECT INBOX returns mailbox state including message counts and UIDVALIDITY. Sequence numbers can change when messages are removed.
3. Fetch only what is needed
FETCH can request flags, headers or body sections. UID commands address more stable identifiers within a mailbox validity period.
4. Synchronize flags
STORE changes flags such as \Seen. Untagged responses can report mailbox changes; tagged responses identify command completion.
5. Finish the session
LOGOUT closes the session. Downloaded content and server-side state are separate: fetching a message need not remove it.
Protocol relationships
Protocols cooperate across layers. Compare the neighboring lessons to distinguish addressing, delivery, application semantics and encryption.
Standards and editorial method
Written and implemented independently by NavSprout. Lessons summarize public protocol standards using synthetic documentation addresses and fictional credentials. Consult the standards for complete wire formats and normative behavior.
RFC 9051 ↗