On Fri, 3 Aug 2001, Andrew Edelstein wrote:
I'd like to set up a filter that will detect messages "From:" certain known
addresses then use formail to replace those headers. Specifically, I receive
mail from several individuals via their cell phones and two-way pagers. I'd
like to replace the address of their two-way device in the From: line with
their regular email address.
Instead of having a seperate recipe for each person, I'd like to store the
device addresses and "real" address in an external file that procmail will
reference. Something like
XXXXXXXXXX(_at_)mobile(_dot_)att(_dot_)net address(_at_)domain(_dot_)tld
I'd prefer to do this in sh rather than perl. I'm sure I've seen very similar
things here before.
--
Andrew Edelstein - andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
Andrew,
Here is a recipe I came up with and did some minimal testing. I
am not an expert on procmail but I have done similar things
before. I wasn't sure what you wanted to do once you changed
addresses so I just stored it in your inbox.
:0
*
From:.*\/(user1(_at_)mobile(_dot_)att(_dot_)net|user2(_at_)mobile(_dot_)att(_dot_)net)
{
OLDADDR=$MATCH
TOADDR=`grep "$OLDADDR" addressmap | awk -c '{print $2}'`
:0 wf:foobar
| formail -I "From: $TOADDR"
:0:
/var/mail/yourmailbox
}
Where the addressmap is your file name and the $MATCH contains the
mobile address. The above recipe may need to be tweaked for safeguards
but I believe it conveys a potential solution. It still requires external
programs (grep and awk).
Note: There may be a way to just get the column 1 (mobile addresses) and
build a regex for the From condition line.
Jim
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail