Moving mail into IMAP server and the Received date

Joseph Brennan brennan at columbia.edu
Mon Feb 19 08:51:10 EST 2007



--On Monday, February 19, 2007 16:32 +1000 RM <m2k7 at liveonthe.net> wrote:

> I've been experimenting with cyrus and some other imap servers which also
> exhibit this problematic behaviour: when I move the mail from a local
> folder to an imap folder under cyrus, my adjacent Windows/OutlookXp mail
> reader sorts the mail by "Received" date, and the date registered as
> "Received" is the time/date that the copy operation is carried out (ie:
> now) rather than the date that the mail was actually originally received.

Outlook uses the internaldate attribute.  RFC 3501 says:

2.3.3.  Internal Date Message Attribute

   The internal date and time of the message on the server.  This
   is not the date and time in the [RFC-2822] header, but rather a
   date and time which reflects when the message was received.  In
   the case of messages delivered via [SMTP], this SHOULD be the
   date and time of final delivery of the message as defined by
   [SMTP].  In the case of messages delivered by the IMAP4rev1 COPY
   command, this SHOULD be the internal date and time of the source
   message.  In the case of messages delivered by the IMAP4rev1
   APPEND command, this SHOULD be the date and time as specified in
   the APPEND command description.  All other cases are
   implementation defined.

The relevant command is APPEND, and its description says:

6.3.11. APPEND Command

   Arguments:  mailbox name
               OPTIONAL flag parenthesized list
               OPTIONAL date/time string
               message literal

   [ . . . ]

      If a date-time is specified, the internal date SHOULD be set in
      the resulting message; otherwise, the internal date of the
      resulting message is set to the current date and time by default.


So when a client moves mail from local to server, it *could* send
an internaldate.  Cyrus honors this.  When we moved from U Wash to
Cyrus we were careful to get the internaldate from U Wash and send
it in the append command to Cyrus.

When the client does not send an internaldate, Cyrus follows the
RFC and assigns the current date and time.  There is no imap command
to change internaldate once it has been assigned.

Ideally you might be able to find a client that sends internaldate
when it moves mail from local to server.  The catch is that since so
many clients, like Thunderbird, do not use internaldate to sort, they
probably don't preserve it in local folders, and they probably don't
try to reconstruct what it was from Received or Date headers when they
append to a folder on server.

It's not really a Cyrus or Outlook bug.

Joseph Brennan
Lead Email Systems Engineer
Columbia University Information Technology












More information about the Info-cyrus mailing list