IMAP has the STATUS command which can give you information like how many of the messages in a folder are not flagged with \Seen. That’s cute, but not as useful as it might sound to most people. This is the problem:
What I want to avoid on a mobile device is having to do a synchronization of a folder. A synchronization the first time means retrieving the summary information like the Uid, the flags and some headers. What use is all this information if this is a folder that will never be viewed by the user of a mobile device? Why waste bandwidth on retrieving this, especially when bandwidth over GPRS is expensive for many people?
How will you know (before said synchronization) whether a message is unread but not deleted and how many of that unseen count, that you got from STATUS, are like this? It’s perfectly possible for a message to be marked both deleted (but not yet expunged) and unread.
“Simple”, I imagining hearing somebody in the audience say: “just mark all messages that you delete as \Seen!”. The problem here is that a mobile E-mail client is most of the times not the primary E-mail client of a user and I can’t control the behaviour of the many E-mail clients being used in the field.
The nice people at Isode specified ESEARCH for things like this. To all developers of IMAP servers: please hurry up implementing this one. With ESEARCH I can get an accurate unread count suitable for mobile devices without having to do a folder synchronization for each and every folder.