Key points
- The current version is IMAP4rev2, defined in RFC 9051.
- Port 993 with implicit TLS is the recommended setup; port 143 is the plain text port.
- IMAP reads mail; sending is done with SMTP.
- Unlike POP3, messages remain on the server until the user deletes them.
- IMAP logins are a frequent target for password guessing.
How does IMAP work?
The program connects, authenticates and selects a folder. It can fetch only the headers to build the message list, download a message when the user opens it and set flags such as read, answered or deleted. Several devices can keep the mailbox open at the same time and see the same changes.
With the IDLE extension, the server tells the program about new mail right away instead of waiting for the next check.
What is the difference between IMAP and POP3?
POP3 was designed to download messages to one computer and usually remove them from the server. IMAP keeps the server as the single source of truth, which suits anyone who uses more than one device. The cost is storage on the server, which grows with every message kept.
Why is IMAP a security concern?
Many account takeovers start with guessed or stolen passwords tried over IMAP, because the protocol needs only a user name and a password. An account that suddenly logs in from many different IP addresses is a strong sign of compromise.
Strong passwords, a second factor where the program supports it and closing the plain text port 143 reduce the risk.
Example IMAP session
S: * OK IMAP4rev2 server ready
C: a1 LOGIN [email protected] secret
S: a1 OK Logged in
C: a2 SELECT INBOX
S: * 12 EXISTS
S: a2 OK [READ-WRITE] Select completed
C: a3 LOGOUT
S: * BYE Logging out
S: a3 OK Logout completedHow AHSU 360 handles this
AHSU 360 detects compromised accounts by spotting logins that come from an abnormal number of IP addresses, using a read-only agent on the mail server. It also blocks attacking IPs automatically and records each action it takes.
