procmail
[Top] [All Lists]

Re: Regenerate From_ with Date in formail

2003-03-01 03:49:58
On Fri, Feb 28, 2003 at 07:54:19PM -0500, Don Hammond wrote:

On 28 Feb, Steve Huntsberry wrote:
|
| > 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.

I know there is a way to tell fetchmail not to do that.  A setting
in the .fetchmailrc will do to allow many, if not all, of these
things you are asking about.  Have you read `man fetchmail'?
I recently did something in fetchmail to turn off its adding a
new top Received: header, for example; though I don't use fetchmail
much and don't remember the details now.

| 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.

You can easily grab only the address from From: with formail.

(.probmail is a file of problematic spam I have lying around.)

 9:51pm [~/Mail] 367[0]> formail -rtz -xTo: -s < .probmail
news(_at_)greeting-cards(_dot_)com
wpfxneg(_at_)newkorea(_dot_)com
info(_at_)imailgolf(_dot_)com
info(_at_)hostingtycoon(_dot_)com
princemax(_at_)37(_dot_)com
bill1(_at_)azxwer(_dot_)com
promo(_at_)vpcshopping(_dot_)com
lust(_at_)xxxsend(_dot_)com
jennylanton(_at_)mail(_dot_)com
amezcua_10(_at_)sd12(_dot_)hostserve21(_dot_)com
ts(_at_)z2p(_dot_)net
GetCozy(_at_)cozybet(_dot_)com
mary(_at_)theproductguys(_dot_)com


So in your recipe, you can just use

        FROMADDY = `formail -rtz -xTo:`

-- 
dman

_______________________________________________
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>