Results 1 to 7 of 7

Thread: Received Date Appears to be Incorrect for Imported Mail

  1. #1
    Join Date
    Sep 2005
    Posts
    135
    Rep Power
    10

    Default Received Date Appears to be Incorrect for Imported Mail

    Gentlemen,

    I used imapsync to move emails from our mail server, and, while it appears the headers are correct in the imported mail (i.e. the "Sent" date shows correctly in Zimbra), the "Received Date" in the mail listbox (conversation view / message view) all show the date the mails were imported into the system. This is also effecting the search function.

    I'm assuming its using an insert date in the mysql datastore, should be pretty easy to write a script to update.. right?

    -a

  2. #2
    Join Date
    Sep 2005
    Posts
    274
    Rep Power
    10

    Default x-zimbra-received

    is it possible to modify imapsync to copy the data header into x-zimbra-received header?
    x-zimbra-received is the override to set the received date.

  3. #3
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default imapsync should be using APPEND with a date-time

    The "received date" should be the same as the IMAP INTERNALDATE. Does imapsync specify an explicit INTERNALDATE when it APPENDs the messages?

  4. #4
    Join Date
    Sep 2005
    Posts
    135
    Rep Power
    10

    Default --syncinternaldates

    Thanks guys,

    yes, there is a specific cmd line option, --syncinternaldates

    this appears to fix the problem, but not for the already-sync'd mail. while the imap headers are changing, that field does not change unless i delete and re-sync the email. is there a way around this, other than deleting and resyncing everything?

  5. #5
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    Default

    I don't believe that IMAP permits you to change the INTERNALDATE for existing messages, so you may be stuck with doing a re-import. We'll note this imapsync flag in the migration instructions so that other folks don't have the same issues.

  6. #6
    Join Date
    Jun 2006
    Posts
    5
    Rep Power
    9

    Default

    Just wanted to add some knowlegde here from my own experience. I had the issue described in the first post where many of my older mail messages were all being imported as a single date ("01-Jun-2006" to be exact). I used the syncinternaldates like suggested but it was no luck. I did some investigation and it looks like my problem was on my old mail server's side (not zimbra yeah!) and it would report bad dates when fetching the time headers. However, even though the time headers (INTERNALDATE) were incorrect imapsync also parses each mail message header and I noticed the dates were correct on these. So I made a quick patch to imapsync that uses the date from the headers if the INTERNALDATE is reported incorrectly (or in my casd 01-June-2006 07:55). This might help someone else out of a jam.

    *Must: apt-get install perl-Time-modules
    *Code must change to enter your own problem date/change timezone

    ***Please use the code below at your own risk. Just a reference***
    Code:
       1329     my $key;
          1 #!/usr/bin/perl -w
          2
          3 use Time::ParseDate;
          4 use POSIX qw(strftime);
    .
    .
    .
       1330         if ($skipsize) {
       1331                 $key = "$m_md5";
       1332         }else {
       1333                 $key = "$m_md5:$size";
       1334         }
       1335
    +   1336     if($idate =~ m/01\-Jun\-2006 07/ && $head->{Date}[0])
    +   1337     {
    +   1338         $idate = strftime('%d-%b-%Y %T -0700',localtime(Time::ParseDate::parsedate($head->{Date}[0])));
    +   1339     }
       1340
       1341     $s_hash->{"$key"}{'5'} = $m_md5;
       1342     $s_hash->{"$key"}{'s'} = $size;
       1343     $s_hash->{"$key"}{'D'} = $idate;
       1344     $s_hash->{"$key"}{'F'} = $flags;
       1345     $s_hash->{"$key"}{'m'} = $m_uid;

  7. #7
    Join Date
    Apr 2008
    Posts
    5
    Rep Power
    7

    Thumbs up

    Thanks! The above didn't quite work for me but this did:

    Code:
    --- imapsync.foo   2008-04-22 03:22:24.000000000 -0700
    +++ imapsync   2008-04-22 03:26:01.000000000 -0700
    @@ -389,6 +389,7 @@
     use English;
     use POSIX qw(uname);
     use Fcntl;
    +use Date::Parse;
    
     eval { require 'usr/include/sysexits.ph' };
    
    @@ -1451,7 +1452,8 @@
            }
            my $size  = $s_fir->{$m_uid}->{"RFC822.SIZE"};
            my $flags = $s_fir->{$m_uid}->{"FLAGS"};
    -       my $idate = $s_fir->{$m_uid}->{"INTERNALDATE"};
    +       #my $idate = $s_fir->{$m_uid}->{"INTERNALDATE"};
    +       my $idate = POSIX::strftime('%d-%b-%Y %T -0800', localtime(str2time($head->{Date}[0])));
            $size = length($headstr) unless ($size);
            my $m_md5 = md5_base64($headstr);
            $debug and print "$s msg $m_uid:$m_md5:$size\n";

Similar Threads

  1. Problems with port 25
    By yogiman in forum Installation
    Replies: 57
    Last Post: 06-13-2011, 02:55 PM
  2. Replies: 7
    Last Post: 02-03-2011, 07:01 AM
  3. fresh install down may be due to tomcat
    By gon in forum Installation
    Replies: 10
    Last Post: 07-25-2007, 09:09 AM
  4. DynDNS and Zimbra
    By afterwego in forum Installation
    Replies: 30
    Last Post: 04-01-2007, 04:34 PM
  5. receiveing mail
    By maybethistime in forum Administrators
    Replies: 15
    Last Post: 12-09-2005, 04:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •