Date: Tue, 18 Jul 2006 22:33:09 -0700 From: Darren Pilgrim <darren.pilgrim@bitfreak.org> To: Lyndon Nerenberg <lyndon@orthanc.ca> Cc: freebsd-isp@freebsd.org, "David J. Orman" <ormandj@corenode.com> Subject: Re: Fix dates via IMAP on messages Message-ID: <44BDC415.6050502@bitfreak.org> In-Reply-To: <20060718113009.L43660@orthanc.ca> References: <ca17c8974fc5.44bbb83c@corenode.com> <20060718113009.L43660@orthanc.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
Lyndon Nerenberg wrote: >> All of my new mail is fine (I run my mailserver now) but my mail from >> about 7-10 years ago is all the date of the migration. Is there any >> program out there that will read the headers of the mail and change >> the server-date of the files? I've tried imapsync with >> -syncinternaldate, to see if it read headers, but it doesn't. I just >> want to be able to run the command on the user/imap server of choice, >> and have it read all the mail headers, and set the creation dates >> properly on the mails (all via IMAP). > > I'm not aware of a tool that will do this, but writing a program to > handle this is trivial. All it needs to do is read the message until you > find the date header, parse the date, then call utimes() to update the > file's mtime. It's far from trivial using the Date header. When I had to do the same post-migration Maildir fix-up David is talking about, I found the format of the Date: header varied so widely that I ended up with tens of thousands (out of an archive of ~300k emails) of messages whose Date headers stumped the date-grokking functions in Perl and Visual Basic. What *is* pretty standard is the timestamps in Received headers. I don't have any messages on hand that were relayed through qmail, but Postfix, Sendmail and a handful of common Windows "enterprise" mail servers all use the same format[1] and place it immediately at the only semi-colon in the header. Since the "Date" on IMAP messages is the message creation time, not the Date header, on most IMAP servers, the timestamp in the top-most Received header is usually pretty close to the date of actual message delivery. [1] "%e %b %Y %T" in strftime(3) parlance. -- Darren Pilgrim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44BDC415.6050502>