Thanks for all the answers to my question. An interesting side note--Microsoft Exchange 2007 rejects * as an invalid message set...
Darren
-----Original Message-----
From: mrc@hsinghsing.panda.com [mailto:mrc@hsinghsing.panda.com] On Behalf Of Mark Crispin
Sent: Thursday, February 17, 2011 12:46 PM
To: Timo Sirainen
Cc: Darren Croke; imap-protocol@u.washington.edu
Subject: Re: [Imap-protocol] detecting new messages
On Thu, 17 Feb 2011, Timo Sirainen wrote:
> Use STATUS for getting UIDNEXT for non-selected mailboxes. For selected
> mailbox, hopefully you don't care about knowing the UIDNEXT value.
The latter point bears emphasis.
There is no particular reason why you should ever need the UIDNEXT value
for the selected mailbox. Although most servers will give you the UIDNEXT
value at SELECT time, it is neither sufficient nor necessary for mailbox
synchronization with prior state.
The UID value of message * is far more important, as this will tell you if
there are new messages in the mailbox that need synchronization. UIDNEXT
may tell you if there WERE new messages, but it will not tell you if there
ARE new messages.
Furthermore, UIDNEXT should rightfully be considered a guess. It is
guaranteed that UIDNEXT is higher than any UID that has ever been assigned
to a message in the mailbox. There is no guarantee that a new message
will given that value as its UID; it may be given a higher value. Nor is
there any guarantee that UIDNEXT is monotonically greater than the highest
assigned UID.
Put another way:
A UIDNEXT value of 1234 guarantees that the highest UID ever placed in the
mailbox is, at most, 1233. It does not in any way assert that UID 1233
exists now, or ever existed in the past.
A UIDNEXT value of 1234 guarantees that a newly delivered message will
have a UID of at least 1234. It does not in any way assert that the
message will get UID 1234 as opposed to UID 1235, UID 69105, etc.
The fact that some servers assign UIDs monotonically does not mean that
servers are required to make monotonic assignments.
-- Mark --
http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
This e-mail and any files transmitted with it are ShoreTel property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited