procmail
[Top] [All Lists]

matching the email address

2003-05-10 22:09:26
The following recipe:

:0
* From:(.*\<)?<\/[a-z0-9=+_.-]+
{ UNAME=$MATCH }


Works fine when the address is in the form

From: Bob Smith <bsmith(_at_)machine(_dot_)tld>  # MATCH contains "bsmith"

it does not work, of course, if the address is

From: bsmith(_at_)machine(_dot_)tld

However. if i remove the < from the match then an email address matches "Bob" in the first line.

I know this has been covered in the archives (that's where I found "From:(.*\<)?\/[a-z0-9=+_-]+") but I can't find a generic solution. All I want is the "username" portion of the From: header so I can filter mail into specific mailboxes:

FRIENDS=$HOME/.friends
:0:
* $? formail -xFrom: | grep -i -f $FRIENDS
$MLDIR/\(Personal\)/$UNAME

while I'm here, I'd also like to be able to say something like

if $UNAME=(smitty|bsmith|bobosmith) UNAME=bsmith (this is obviously not procmail code) for those people with multiple email addresses. I realize this will mean hardcoding those special users, but I don't mind doing that. However, I don't want to hardcode the rest.

--
There is no Satan.  That's just god when he's drunk.


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