On 25 Aug 2013, at 22:41 , Mike Seda <m...@seda.net> wrote:
> It's possible to modify the Date field on MUA side, if one were so inclined, 
> right?

Yes, but I am having trouble thinking of a case where it is really actually 
truly a good idea.

> If so, how would that be accomplished?

I'd use procmail and formail? You could add a header X-Date-Received or simply 
overwrite the header, or even do something like put the contents of Date: into 
X-Old-Date and write the current date into a new Date:

It's not as trivial as you might think to do it right. For example, you would 
need to account for pesky things like time zones.

Also, if you use Maildir, the 'header' date is not really that important; it is 
the date stamp when the file was written that determines sorting, for example.

I did this long ago in procmail to 'repair' some mbox files (so it rewrote the 
FROM_ header), but when I had to reprocess a bunch of mail that was munged, I 
had to grab the date out of the received header for my server and parse it to 
reformat it for the FROM_ header. The idea should be basically the same for 
rewriting the Date header, but is probably easier as I think, generally, 
Received dates and Date: headers are the same format?  

Received: Sun, 25 Aug 2013 22:42:02 -0600 (MDT)
Date:     Mon, 26 Aug 2013 00:41:35 -0400

Almost the same. Almost. 

If I were doing it now I would probably do something like feed the Received 
date into gnu date with a timezone change, and use the output to set the new 
header; that should work pretty easily.

 $ gdate --date='TZ="-0600" Mon, 26 Aug 2013 00:41:35 -0400' 
Sun Aug 25 22:41:35 MDT 2013

Put in a comma and the timezone offset -0600 and Robert is your mother's 
brother.

I may write something to rename the Maildir files (which use an epoch 
timestamp) to the correct epoch time for their Date: headers. I have a few 
thousand messages from 2009 that sort incorrectly because their names are wrong 
in the maildir.

-- 
Nihil est--in vita priore ego imperator Romanus fui.

Reply via email to