From owner-freebsd-isp@FreeBSD.ORG Wed Jul 19 05:33:11 2006 Return-Path: X-Original-To: freebsd-isp@freebsd.org Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92A8616A4E0 for ; Wed, 19 Jul 2006 05:33:11 +0000 (UTC) (envelope-from darren.pilgrim@bitfreak.org) Received: from mail.twinthornes.com (mail.twinthornes.com [65.75.198.147]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4432B43D45 for ; Wed, 19 Jul 2006 05:33:11 +0000 (GMT) (envelope-from darren.pilgrim@bitfreak.org) Received: from [10.242.169.24] (c-67-171-135-169.hsd1.or.comcast.net [67.171.135.169]) by mail.twinthornes.com (Postfix) with ESMTP id 59E5621; Tue, 18 Jul 2006 22:33:08 -0700 (PDT) Message-ID: <44BDC415.6050502@bitfreak.org> Date: Tue, 18 Jul 2006 22:33:09 -0700 From: Darren Pilgrim User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Lyndon Nerenberg References: <20060718113009.L43660@orthanc.ca> In-Reply-To: <20060718113009.L43660@orthanc.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-isp@freebsd.org, "David J. Orman" Subject: Re: Fix dates via IMAP on messages X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2006 05:33:11 -0000 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