Incorrect sort order when sorting by date

Robert Mueller (web) robm at
Mon May 18 08:21:58 EDT 2009

I bet if you look at the Date headers of the problem emails, you'll find
that they're not RFC compliant.

The cyrus date parser is very strict, and if the header isn't RFC
compliant, you'll get a bad value, and bad sorting.

Looking at the RFC

   If the sent date cannot be determined (a Date: header is missing or
   cannot be parsed), the INTERNALDATE for that message is used as the
   sent date.

I'm not cyrus is actually doing this though,


On Mon, 18 May 2009 12:18 +0100, "Gavan Fantom" <gavan at>
> I have been running cyrus imapd for several years now. I recently 
> installed roundcube, to provide access to email on those occasions when 
> a proper IMAP client isn't available.
> Unlike Thunderbird, roundcube relies on IMAP SORT. When sorting by date, 
> some emails from the past are presented as newer than the most recent 
> messages.
> There is nothing in the headers which looks particuraly different, and 
> those messages are stored in the correct order in the filesystem. The 
> timestamp on the messages is consistent with the Date: header.
> I verified that this was imapd getting it wrong, using
> It returned messages in the same order as roundcube had displayed them.
> One of the messages was from March this year (a facebook notification 
> message, much the same as many other such messages - there really was 
> nothing to stand out about this one) and the other messages were 
> periodic updates from another website, spread across the last couple of 
> years. Again, there was nothing particularly special that I could see 
> about the headers in any of these messages.
> I tried running reconstruct on the folder after renaming the 
> cyrus.{cache,header,index} files. Suspiciously, it recreated absolutely 
> identical files. Perhaps it found the files that I had renamed.
> I see that this exact problem has been asked about before:
> but there was no reply at the time. I also couldn't find a report about 
> this issue in bugzilla.
> I am running cyrus imapd 2.2.13 on NetBSD, as installed from pkgsrc.
> Does anybody understand what is causing this?
> -- 
> Gillette - the best a man can forget
> ----
> Cyrus Home Page:
> Cyrus Wiki/FAQ:
> List Archives/Info:
robm at
Sign up at for fast, ad free, IMAP accessible email

More information about the Info-cyrus mailing list