procmail
[Top] [All Lists]

Re: Procmail filter wrong name for email address

2010-09-16 11:40:01
At 01:13 2010-09-16, ProcMail wrote:
Hi
It's only for 2 email addresses.

Is there specific text you _expect_? I've got it that you want to fail if anything other than mary appears, but "mary johnson" "mary" "mary j" "m johnson" (and others) would all be legit. People type all sort of nonsense into their addressbooks, and their MUAs yank that out automatically for the text description of the address.

# this matches for the address, then checks to see if the word mary appears
# in a context where it is NOT immediately followed by an @ (i.e. won't match
# the token in the local portion of the email address itself).  This doesn't
# require an external process (which grep would).
:0
* ^To:(_dot_)*mary(_at_)domain\(_dot_)tld
* ! ^To:.*\<mary[^(_at_)]
{
        # textual name violates criteria
}

of course, this would chuff up if the mary is part of some other text - the exclusionary character class could be expanded to exclude letters and numbers, etc). "st. mary's college" for example.

Bear in mind that such simplistic matches will run into issues with encoded text.

Your criteria doesn't specify how things should be handled if there's _no_ name text (which really should be a valid case, IMO).
---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>