On this page
IMAP vs. POP3
POP3 downloads emails to the local device and then deletes them from the server, while IMAP keeps emails on the server for multi-device synchronization. IDLE enables IMAP to achieve "pseudo-push" notifications—informing the client when new mail arrives, eliminating the need for polling.
Overview
SMTP is responsible only for email transmission, not for storage or retrieval. IMAP (1994) and POP3 (1988) are two email access protocols. IMAP stores emails on the server, with the client acting merely as a "view"—enabling automatic multi-device synchronization, server-side search, and real-time push via IDLE. POP3 is simpler: it downloads emails locally and removes them from the server. IMAP has become the default choice, while POP3 is used only in specific archiving scenarios.
IMAP Protocol
IMAP is a stateful protocol—emails are stored on the server, and the client operates on the server-side mailbox:
Connection:
S: * OK Dovecot ready.
C: a001 LOGIN user@example.com password
S: a001 OK Logged in
List mailboxes:
C: a002 LIST "" "*"
S: * LIST (\HasNoChildren) "/" INBOX
S: a002 OK
Select mailbox:
C: a003 SELECT INBOX
S: * 42 EXISTS ← Total 42 messages
S: * 5 RECENT ← 5 newly arrived
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
S: * OK [UIDVALIDITY 1]
S: * OK [UIDNEXT 43] ← UID for the next message is 43
S: a003 OK [READ-WRITE] SELECT completed
Fetch messages:
C: a004 FETCH 1:10 (FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (FROM SUBJECT DATE)])
→ Fetch partial headers for messages 1-10
Mark as read:
C: a005 STORE 1 +FLAGS (\Seen)
IDLE (Real-time push):
C: a006 IDLE
S: + idling
(New message arrives)
S: * 43 EXISTS
C: DONE
S: a006 OK IDLE completed
Comparison with POP3
| IMAP | POP3 | |
|---|---|---|
| Email Storage | Server (client is a view) | Downloaded locally |
| Multi-device | ✓ | Emails scattered across devices |
| Search | Server-side SEARCH | Local search after download |
| Push | IDLE (real-time) | None (polling) |
| Offline | Requires caching | ✓ |
References
- RFC: 3501, 2177, 1939
- Dovecot: dovecot.org
Keywords: IMAP, SELECT, FETCH, IDLE, POP3, Dovecot, mailbox, flag