Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Installation

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-03-2005, 11:48 AM
Special Member
 
Posts: 135
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
Reply With Quote
  #2 (permalink)  
Old 10-03-2005, 12:25 PM
Zimbra Employee
 
Posts: 274
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.
Reply With Quote
  #3 (permalink)  
Old 10-03-2005, 12:59 PM
Zimbra Employee
 
Posts: 1,434
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?
Reply With Quote
  #4 (permalink)  
Old 10-03-2005, 02:12 PM
Special Member
 
Posts: 135
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?
Reply With Quote
  #5 (permalink)  
Old 10-03-2005, 02:22 PM
Zimbra Employee
 
Posts: 1,434
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.
Reply With Quote
  #6 (permalink)  
Old 06-26-2006, 08:44 AM
dwp dwp is offline
Junior Member
 
Posts: 5
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;
Reply With Quote
  #7 (permalink)  
Old 04-22-2008, 04:33 AM
Junior Member
 
Posts: 5
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";
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0