From: "Darrell" <[EMAIL PROTECTED]>
> We're testing the imapmigrate scripts (from
> http://prdownloads.sourceforge.net/cyrus-utils/) to migrate from a
> netscape messenging server to cyrus 1.5.19 (yes i know its an old
> version, but its a version i we know well and our needs are simple ;-).
>
> All seems fine, except that all versions of Outlook and Outlook Express
> we've tested, when pointed at the new server, show the 'received' date
> of all emails as the time the migration tool place, rather than the
> correct time that the message was originally received...other mail
> clients (various versions of NM and pine) diplay the received field
> correctly.
>

>
> Interestingly, the 'Sent' date field in Outlook IS correct after
> migration...so adding this field to the users' list of visible fields
> and sorting accordingly is a workaround, but not a solution.
>
> SO
>
> I'm wondering if anyone has any ideas/experience in ways to hack
> imapmigrate to work properly with (broken mail clients like) outlook?
>
The way cyrus works is that it shows the Date the message was delivered to
the mail spool by reading the date from the file system for its received
date to show to the IMAP mail clients.  Cyrus doesn't parse the first
Received header to get the received date.

The problem is not with the mail clients, but with the imapmigrate script.
This script should be getting the received date from the old server, and
then using it when storing the message on the new server.

I had a similar problem when migrating messages using the mbox2imap.pl
script.  When I changed the script to parse the 1st Received header for the
received date and then store the message with this received date, the IMAP
clients showed the correct received date.

    From mbox2imap.pl (NetxAP):
        $response = $IMAP->append($mailbox, $message, Flags =>
["$msgFlags"], Date => $msgDate);

Imapmigrate needs to be changed to get the received date from the old IMAP
server and store it on the new IMAP server.  The following changes to
imapmigrate are untested (goto line 505 in imapmigrate to make the changes):

        # get a list of message ID numbers in the selected folder,
        # and for each one get the text of the message and the read/unread
        # and other IMAP flags, and copy them to the new server

        for $msg ($oldimap->search(ALL)) {
            my $msgtext = $oldimap->message_string($msg);
            my @flags = $oldimap->flags($msg);
+           my $msgdate = $oldimap->internaldate($msg);
            my $flg = "";
            for (@flags) {
                $flg .= $_ . " ";
            }
            chop($flg);

-            $newimap->append_string($newfolder, $msgtext, $flg);
+            $newimap->append_string($newfolder, $msgtext, $flg, $msgdate);
        }
    }

Scot

Reply via email to