procmail
[Top] [All Lists]

Re: Maildir and "Date Received"

2009-03-01 13:46:21
On 1-Mar-2009, at 00:56, Michelle Konzack wrote:
Am 2009-02-28 14:08:15, schrieb LuKreme:
It looks like Maildir (or at least Courier) gets its mail received time
stamp from the time on the file itself.  For most things this doesn't
matter, even with my wholesale moving of messages, but for at least one user it really does matter. So, before I move all their mbox-based mail to Maildirs, how do I preserve the received time stamp that will show up
in their MUA?
------------------------ END OF REPLIED MESSAGE ------------------------

If you filter the message with procmail, you can use TRAP and a script
which:

1)  use fomail to get the Date: (or the most recent Received: header)
2)  date --date="${RECV_TIME_RFC}" +%s

This seems trickier than I would have thought. even with a formail -x Date: the resulting datestamp is not really usable by date as it is. Or do you have a newer/better date command? Extracting from Received I can do, I even have a procmail 'fix date' that does just that, but that option is slow.

3)  check, whether in the folder is a file which match

       ${FOLDER}/${RECV_TIME_UNIX}.??*

where ?? is a number between 00 and 99 and generate a filename which
   does not exist like 1234567890(_dot_)00(_at_)${FQDN_LOCAL}

1235796458.94846_2.mail.covisp.net\:2\,S seems to be the pattern used, though I expect that's completely flexible as long as the epoch time is followed by a period and file names don't collide.

4)  rename the original file in the mailfolder to the new filename
5)  touch --date="${RECV_TIME_RFC}" ${NEWFILE}

Ah, so the received time is the actual file name.

--
Women and cats will do as they please, and men and dogs should
        relax an get used to the idea.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>