procmail
[Top] [All Lists]

Re: Changing From: headers

2001-08-03 17:40:56


On Fri, 3 Aug 2001, Andrew Edelstein wrote:

:0
* 
From:.*\/(user1(_at_)mobile(_dot_)att(_dot_)net|user2(_at_)mobile(_dot_)att(_dot_)net)

  TOADDR=`grep "$OLDADDR" addressmap | awk -c '{print $2}'`

This would work, but I don't quite like the matching condition. I'd have to
update both the rc file AND the external file every time I add a new address
to be matched.

I know you didn't want to use Perl but if you place this at the top of
your rcfile it should work.

MAP=/my/address/mapfile
FRIENDS=`cat $MAP|perl -ane 'push @addrs,$F[0]; END{print join("|",@addrs);}'`


Then based on your earlier observations use:

:0
*$^From:.*\/($FRIENDS)
{
     OLDADDR=$MATCH
     TOADDR=`grep "$OLDADDR" $MAP | awk -c '{print $2}'`

     :0 wf:foobar
     | formail -i "From: $TOADDR"
}


Hope this is useful.
Jim








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