Bookmarks

IMAP — Internet Message Access Protocol

The way a mail client works with a mailbox on a server: messages and folders stay there, and every device sees the same thing.

Also: IMAP, IMAP4, IMAP4rev2

checked 9 Nov

All terms

IMAP gives access to a mailbox that lives on the server. The client reads messages, files them into folders and sets flags, and all of this looks the same on a phone, a laptop and in webmail.

What IMAP can do

FeatureWhat it means
Folderscreating, renaming and deleting folders (IMAP calls them mailboxes)
Flags\Seen, \Answered, \Flagged, \Deleted are stored on the server
Searchthe SEARCH command runs on the server, without downloading messages
Partial fetchonly the headers or a single attachment can be fetched
Synchronisationan offline client compares its state with the server

The specification is RFC 9051 (IMAP4rev2, August 2021), which replaced RFC 3501. The server listens on port 143 (unencrypted, usually with STARTTLS) or port 993 (implicit TLS); RFC 8314 recommends the latter.

An example session

textEach command starts with a tag (a1, a2…), and the reply repeats it
C: a1 LOGIN anna secretS: a1 OK LOGIN completedC: a2 SELECT INBOXS: * 3 EXISTSS: a2 OK [READ-WRITE] SELECT completedC: a3 FETCH 3 (FLAGS BODY[HEADER])C: a4 LOGOUT

In IMAP, messages do not disappear until the user deletes them: this is what sets the protocol apart from POP3.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

In depth in the references

where the topic is covered in detail