IMAP folders, flags and IDLE: how push e-mail works and why a folder lags behind

E-mail·· 4 views· 4 min read

The short answer: with IMAP the mail lives on the server, and what your program shows is a reflection of three things: the folders (which exist on the server), each message’s flags (read, answered, flagged, deleted) and notifications. “Instant” (push) e-mail comes from a command called IDLE: the program keeps a connection open and the server tells it when something arrives. But IDLE usually watches one folder at a time, which is why the Inbox is instant and other folders only update every so often.

The parts of IMAP and what they do

Part What it is What goes wrong
Folders They exist on the server. The program shows only the subscribed ones, and recognises the special ones (Sent, Trash, Junk, Drafts) by attributes the server announces. A folder created in webmail does not appear on the phone (it is not subscribed), or the program makes its own “Sent Items” next to the server “Sent”.
Flags Labels per message: \Seen (read), \Answered, \Flagged, \Draft and \Deleted (marked for deletion). They live on the server, and every device sees them. Reading on the phone marks it read on the computer: that is the right behaviour. If it does not happen, one of the accounts is POP.
\Deleted and EXPUNGE Deleting in IMAP takes two steps: flag it \Deleted, then expunge, which removes it for good. Many programs move to Trash instead. Struck-through messages that never go away and keep using space: the program flagged them but did not expunge.
IDLE (push) The program says IDLE and listens on one folder; the server sends a line when something arrives or changes. Other folders are only seen when the program checks them. On a phone, the system may cut the connection to save battery, and push turns into a periodic check.
Simultaneous connections Each watched folder and each device opens its own connection to the server. With many devices and watched folders at once, the server may refuse new connections (“too many connections”).

Getting folders and push to behave

1 Subscribe the folders you want to see in each program. In webmail and most programs there is a “Manage folders” or “Subscribe” option; in classic Outlook it is called “IMAP Folders”. The names change with the version and language.
2 Tell the program which folders are the special ones: Sent, Trash, Drafts and Junk should point to the server folders, not to local copies. For Outlook it is explained in sent and deleted e-mails missing in Outlook.
3 Choose move to Trash rather than just flag: if the program offers “mark as deleted” or “strike through”, switch to “move to Trash”, or expunge the folder from time to time (Compact, Expunge or Purge, depending on the program).
4 To get push on a folder other than the Inbox, see whether the program can watch several folders or check that folder more often. If it cannot, create a filter on the server that leaves in the Inbox what you need to see straight away.
5 To confirm the server accepts IDLE, ask it for its capability list (CAPABILITY): it is explained in testing IMAP, POP3 and SMTP by hand.
Deleting in IMAP deletes everywhere. Because the message exists only once, on the server, deleting it on the phone and expunging removes it from the computer and from webmail too. If you want a copy of your own, make one on purpose: keeping your own copy of your e-mail.
Many devices, many connections. If you see connection errors only when everything is open, close the program on a device you no longer use, or watch fewer folders.

A folder does not update on one device but is right in webmail? Tell us the program, the device and the folder name.

Open a support ticket

SEE ALSO

POP or IMAP: which to choose, and what you lose by picking wrong

Outlook is not syncing: missing e-mails and folders that do not update

Sent and deleted e-mails missing in Outlook with IMAP: setting the right folders

Testing IMAP, POP3 and SMTP by hand with openssl s_client: a guide for technical users

How to access your webmail

Your mailbox is full: what to delete and how to stop it happening

RECOMMENDED PRODUCT

Professional e-mail on your domain

Mailboxes in your company name, no adverts, with spam filtering. from $5.36/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.