RFC 9051: Internet Message Access Protocol (IMAP) Version 4rev2

The current IMAP standard for online mailbox access, folder management, and message retrieval.
Alaa
By Alaa
SMTPedia documents email infrastructure end to end: SMTP standards from the RFC archive, delivera...
8 min read Updated Jul 22, 2026 144 views
RFC 9051
Internet Message Access Protocol (IMAP) Version 4rev2
Current standard
Domain
IMAP
Published
August 2021
Obsoletes
RFC 3501
SMTP relevance
foundational
↗ Read on rfc-editor.org

What this RFC defines

RFC 9051 defines IMAP version 4rev2, the current standard for accessing email stored on a server. Unlike POP3, IMAP keeps messages on the server and synchronizes state across multiple devices. It supports folders, flags, search, and partial message retrieval.

Where you see it in practice

Every modern email client that shows your inbox across multiple devices (phone, laptop, web) is using IMAP. The folder structure you see in your email client (Inbox, Sent, Drafts, Trash) is managed via IMAP SELECT and CREATE commands. The unread/read sync that happens when you open a message on your phone and it immediately marks as read on your laptop is an IMAP flag update (Seen flag) propagating to all connected clients.

How it connects to other RFCs

RFC 9051 obsoletes RFC 3501 (IMAP4rev1 from 2003). It works alongside RFC 2177 (IDLE command for real-time notifications), RFC 4551 (CONDSTORE for atomic flag updates), and RFC 6851 (MOVE command). RFC 8314 mandates TLS for IMAP connections (port 993).

Current status

RFC 9051 is the current IMAP standard, published August 2021. It supersedes RFC 3501 with clarifications, UTF-8 improvements, and tighter security requirements. New IMAP deployments should reference RFC 9051.

The IMAP protocol overview

RFC 3501 defined IMAP version 4rev1, which was the dominant IMAP standard from 2003 to 2021 when RFC 9051 (IMAP 4rev2) was published. IMAP is a stateful protocol where a client authenticates, selects a mailbox, and then issues commands to search, fetch, and modify messages on the server. Unlike POP3, IMAP messages remain on the server by default; the client caches them locally but the server holds the authoritative copy. This is why the same account can be accessed from multiple devices with consistent state.

IMAP versus POP3 architecturally

IMAP is stateful and expressive; POP3 is stateless and minimal. IMAP supports server-side folders, per-message flags (Seen, Answered, Flagged, Draft, Deleted), server-side search, partial message fetches (fetch headers only, or a specific MIME part), quotas, ACLs, and many extensions layered on top. POP3 supports downloading whole messages and marking them for deletion. Any client that provides features like Sent folders shared across devices, unread badge counts synced across phones and desktops, or server-side search is using IMAP.

Superseded by RFC 9051

RFC 9051 (IMAP 4rev2), published in August 2021, updated RFC 3501 with clarifications, integration of common extensions into the base standard, and internationalization improvements. In practice, RFC 3501 remains the most widely-deployed IMAP standard in 2026. Most servers negotiate 4rev1 by default, with 4rev2 being adopted incrementally. Any implementation that references RFC 3501 is operating on the standard that runs the majority of world IMAP traffic today.

Quick Reference

RFC 3501 (March 2003) defines IMAP4rev1 (Internet Message Access Protocol version 4 revision 1): the mail access protocol used by Gmail, Outlook, iCloud, Yahoo Mail, and virtually every other mailbox service. Unlike POP3, IMAP keeps messages on the server, supports folders, allows partial fetches (headers only, specific parts), and provides server-side search and flags. Port 143 (STARTTLS via RFC 2595) or 993 (implicit TLS per RFC 8314). Updated by RFC 9051 (IMAP4rev2, 2021) but IMAP4rev1 remains dominant.

RFC 3501 at a glance

AspectDetail
PurposeClient access to remote mailboxes with server-side state
ModelMessages stored on server; client synchronizes selectively
Ports143 (STARTTLS), 993 (implicit TLS)
vs POP3IMAP is stateful, folder-aware, and message-partial-fetch capable; POP3 is stateless download-then-delete
SuccessorRFC 9051 IMAP4rev2 (2021)
PublishedMarch 2003 (obsoletes RFC 2060)
Deployment 2026Dominant; RFC 9051 IMAP4rev2 adopted incrementally

Core IMAP commands

CommandPurposeState required
CAPABILITYList server capabilitiesAny
STARTTLSUpgrade to TLSNot authenticated
AUTHENTICATESASL authenticationNot authenticated
LOGINSimple username/password authNot authenticated
LISTList folders (mailboxes)Authenticated
SELECTSelect mailbox for message operationsAuthenticated
EXAMINESelect mailbox read-onlyAuthenticated
FETCHRetrieve message data (headers, body, structure)Selected
SEARCHServer-side search across selected mailboxSelected
STORESet message flags (Seen, Flagged, Deleted, etc.)Selected
COPY, MOVECopy/move messages between mailboxesSelected
EXPUNGEPermanently remove messages marked DeletedSelected
IDLEServer pushes updates until client cancels (RFC 2177)Selected
LOGOUTEnd sessionAny

The FETCH command: selective message retrieval

IMAP FETCH examples Fetch just message flags and size: C: A001 FETCH 1:10 (FLAGS RFC822.SIZE) S: * 1 FETCH (FLAGS (\Seen) RFC822.SIZE 1234) S: * 2 FETCH (FLAGS (\Seen \Answered) RFC822.SIZE 5678) … S: A001 OK FETCH completedFetch envelope (parsed From/To/Subject/Date without body): C: A002 FETCH 1 (ENVELOPE) S: * 1 FETCH (ENVELOPE (“Wed, 15 Jul 2026 09:15:22 +0000” “Meeting agenda” ((“Alice” NIL “alice” “sender.com”)) ((“Alice” NIL “alice” “sender.com”)) NIL ((“Bob” NIL “bob” “example.com”)) NIL NIL NIL “<abc@sender.com>”)) S: A002 OK FETCH completedFetch just headers: C: A003 FETCH 1 (BODY.PEEK[HEADER]) S: * 1 FETCH (BODY[HEADER] {1234} From: Alice … S: A003 OK FETCH completedFetch specific body part (attachment 2, base64): C: A004 FETCH 1 (BODY.PEEK[2]) S: * 1 FETCH (BODY[2] {56789} [base64 attachment content] S: A004 OK FETCH completedThe BODY.PEEK vs BODY distinction: BODY[…] Marks message as \Seen (read) BODY.PEEK[…] Does not modify \Seen flag

System-defined message flags

FlagMeaningSet by
\SeenMessage has been readClient (implicit on BODY fetch) or STORE
\AnsweredMessage has been replied toClient via STORE
\FlaggedMarked for follow-up (starred)Client via STORE
\DeletedMarked for deletion (removed on EXPUNGE)Client via STORE
\DraftMessage is a draftClient via STORE or APPEND
\RecentNew arrivals since last SELECTServer automatic; deprecated in IMAP4rev2

Common IMAP client mistakes

Fetching full messages when only headers are needed. IMAP’s power is partial fetching. Downloading full RFC822 content for every message defeats the protocol’s efficiency and drives up bandwidth. Fetch ENVELOPE for header data; use BODY.PEEK[HEADER] or BODY.PEEK[HEADER.FIELDS (…)] for specific headers only.
Not using IDLE for real-time updates. Polling INBOX every N seconds wastes bandwidth and battery. RFC 2177 IDLE keeps a persistent connection and pushes updates when messages arrive. Every modern IMAP client should use IDLE; servers must support it (most do). Fall back to polling only when IDLE is not available.
Not implementing CONDSTORE and UIDPLUS. Extensions that reduce synchronization traffic significantly. CONDSTORE (RFC 4551) lets clients efficiently sync only changed messages. UIDPLUS (RFC 4315) provides UIDs on APPEND and better handling of expunged messages. Most modern servers support both; using them reduces load on both sides.
Confusing sequence numbers with UIDs. Sequence numbers (1, 2, 3, …) are position within selected mailbox and shift when messages are expunged. UIDs are persistent identifiers that never change. Use UIDs (UID FETCH, UID STORE) for anything the client needs to remember across sessions; sequence numbers only within a single SELECT.
Not handling unsolicited server responses. IMAP servers can send untagged responses at any time (new message arrival, flag changes by another client, expunge notifications). Clients must parse and handle these, not treat them as errors. The IMAP protocol is asynchronous within a session.
IMAP ecosystem RFCs
  • RFC 2060: Original IMAP4rev1 (obsoleted by RFC 3501)
  • RFC 9051: IMAP4rev2 (2021 update)
  • RFC 2177: IDLE extension (real-time updates)
  • RFC 4315: UIDPLUS extension
  • RFC 4551: CONDSTORE extension
  • RFC 5256: SORT and THREAD extensions
  • RFC 6851: MOVE extension
  • RFC 2595: STARTTLS for IMAP
  • RFC 8314: Cleartext obsolete for access
SMTPedia companion guides

Frequently asked questions

Should I still use RFC 3501 IMAP4rev1 or move to RFC 9051 IMAP4rev2?

RFC 3501 remains the dominant standard in 2026. RFC 9051 IMAP4rev2 (2021) folds in widely-used extensions (UTF-8 support, CONDSTORE, MOVE) and removes deprecated features. Adoption is incremental; most servers advertise both IMAP4rev1 and IMAP4rev2 capabilities. New client implementations should target rev2 with rev1 fallback; new server deployments should advertise both.

What is the difference between IMAP and POP3?

Model. IMAP keeps messages on the server; the client sees them as a remote folder tree, can search server-side, and syncs flags across devices. POP3 downloads messages to the client and typically deletes them from the server (or leaves for a grace period). IMAP suits multi-device users (phone + desktop + web); POP3 suits single-device users with limited connectivity. In 2026 nearly all consumer mail uses IMAP; POP3 remains for legacy and specialized use.

Why does IMAP use both sequence numbers and UIDs?

Different lifetimes. Sequence numbers are 1..N position within selected mailbox; they shift when messages are expunged (message 5 becomes 4 when message 3 is expunged). UIDs are permanent identifiers that never change (once assigned, a UID belongs to that message forever). Client code that persists message references across sessions must use UIDs; within a single SELECT, sequence numbers are convenient for iteration.

What is IDLE and why is it important?

IDLE (RFC 2177) is an IMAP extension that keeps the connection open with the server pushing updates as they arrive. Instead of polling every 30 seconds, the client issues IDLE and waits for the server to notify about new messages, flag changes, or expunges. Reduces latency (instant notification), bandwidth (no polling overhead), and battery (idle connection is cheaper than repeated polls). Every modern mail client uses IDLE; PUSH notifications on mobile IMAP typically implement this pattern.

Can I use IMAP without TLS?

Technically yes, practically no. Cleartext IMAP transmits passwords and message content in the open. Per RFC 8314, cleartext access is obsolete. Modern clients default to implicit TLS on port 993. Servers should refuse LOGIN before STARTTLS (advertise LOGINDISABLED) or refuse cleartext connections entirely. Only legacy or specialized internal-network deployments should use cleartext IMAP; even then, wrap in VPN or private network.


About the Author

Alaa - SMTPedia author

Alaa · LinkedIn

Email infrastructure specialist with 8+ years of hands-on experience in SMTP, deliverability, and email verification. I’ve configured and troubleshot mail systems across Postfix, Exchange, and cloud relays, managed IP reputation and warmup campaigns, and built verification pipelines processing millions of addresses. My work spans DNS authentication (SPF, DKIM, DMARC, BIMI), bounce handling, blocklist monitoring, and compliance frameworks including CAN-SPAM and GDPR. I write every article on SMTPedia to give email professionals, developers, and marketers the accurate, RFC-grounded reference they need.


About SMTPedia

SMTPedia is an independent email industry reference covering SMTP, IMAP, POP3, email deliverability, marketing platforms, DNS authentication, and email verification. Every article is researched from official provider documentation, IETF RFCs, and industry best practices. Settings and configurations are verified quarterly.

We are cited as a source by ChatGPT, Microsoft Copilot, and thousands of email professionals worldwide. Learn more about our editorial process.