procmail
[Top] [All Lists]

Re: Regenerate From_ with Date in formail

2003-02-28 17:59:21
On 28 Feb, Steve Huntsberry wrote:
| It sounds like I should use the last Received: fields instead of Date:
| to regenerate the From_ header. Date: is date sent and could be wrong.
| 
| How do I do this in formail? Can I grab the date in the Received: field
| and create a new From_ field? They seem to have different date formats.
| 
| > 
| > From shuntsbe(_at_)mail-pop Tue Feb 18 18:16:28 2003 -0800
| > Return-Path: <owner-javascript(_at_)adobe(_dot_)com>
| > Received: from cliff.corp.adobe.com ([153.32.1.186]) by
| >         mailsj-v1.corp.adobe.com (Netscape Messaging Server 4.15 v1 Jul
| >         11 2001 16:32:57) with ESMTP id H9YSQT00.2UV; Fri, 7 Feb 2003
| >         16:44:53 -0800
| > Date: Fri, 7 Feb 2003 16:45:00 -0800
| > From: Mark Erickson <mark(_dot_)erickson(_at_)adobe(_dot_)com>
| > 
| 
| These mails occur when I copy from one IMAP server to another.
| It sets the From to my address, at the time I make the copy.
| 
| Therefore, I also need to change the address in the From_.
| For example, here I want a From_ field that looks like:
| 
| > From mark(_dot_)erickson(_at_)adobe(_dot_)com Fri Feb  7 16:44:53 2003 -0800
| 
| I might want the Sender: and not From: if Sender: is present.
| 
| Is any of this possible in formail or must I write some Perl?
| 

You've added some needs since your original message.  There is an
example rcfile and suggested usage and testing for the first request at:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-02/msg00544.html

It does not deal with the two requirements mentioned here.  Those
should be relatively easy to add.  In that rcfile, before the first
recipe that matches Return-Path, add a similar recipe that does the same
with Sender:, and another that tests for From: if Sender: doesn't exist.
I suppose you can then get rid of the Return-Path: recipe or make it
contingent on these two new ones failing.  Whichever of those addresses
exists replaces $RETURNPATH where it's added to the variable $ENVELOPE. 
Because the Return-Path: contains a simple <user(_at_)domain(_dot_)tld> and the
From: header likely contains more than that, you'll have to take some
additional care to extract just that part from the From: header.  The
same may apply to Sender:.

BTW, I just noticed a typo in the message referred to above.  There is
an extra :0 which should be obvious, and should be removed.

-- 
Email address in From: header is valid  * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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