* Lee Hoffner <lhoffner(_at_)directedmotion(_dot_)com> :
Upon achieving a match, I have a line in my recipe that extracts the sender's
address and stores it to pass of to a PERL script. The problem is,
ADDRESS=`formail -rzx "To:"`
sometimes returns a proper name before the email address. (Example from
procmail log: Assigning "ADDRESS="Jim Bernardi"
<jbernardi(_at_)23skidoo(_dot_)net>").
This is tripping up the perl script, which is matching $ADDRESS to a MySQL db
that contains only email addresses without names.
How can I ensure that ADDRESS contains only the email address, losing any
proper name that might be in front of it?
Thank you for any help you can give.
I have in the past used all of these to extract clean from email
addresses :
WHITELIST=~/.aliases
WHITE=~MAIL/white
CLEAN_FROM=`formail -x "From:" -x "From" -x "Sender:" | sed -e
"s/^.*[^A-Za-z0-9_.+-]\([A-Za-z0-9_(_dot_)+-]*(_at_)\)/\1/" -e
"s/\(@[A-Za-z0-9_.+-]*\)[^A-Za-z0-9_.+-].*$/\1/"`
# careful of the line wraps above
:0
* ^(From:|From|Sender:|Reply-to:|Return-Path:)\
.*\/[A-Za-z0-9_(_dot_)+-]+(_at_)[A-Za-z0-9_(_dot_)+-]+
* ? grep -i "$MATCH" $WHITELIST
$WHITE
:0:
* ^TO_(troy)@(piggo.com)
* ? cat $WHITELIST | fgrep -i -is $CLEAN_FROM
$WHITE
:0:
* ^TO_(troy)@(piggo.com)
* ? formail -x "From:" -x "From" -x "Sender:" \
| egrep -i -is -f $PROCMAILDIR/list.white
$WHITE
--
T R O Y P I G G I N S
e : troy(_at_)piggo(_dot_)com
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail