procmail
[Top] [All Lists]

Re: How do you strip characters from the from?

2004-11-23 14:12:29
At 06:19 2004-11-23 -0500, Poohba wrote:
I have, which I assume is wrong because its not working:

If you enabled VERBOSE logging, you'd probably also see error messages...

Hopefully, you're doing this testing in a sandbox.  If not, you should be.

BLACK=$HOME/.kills
:0:
* ^From:.*\/[A-Za-z0-9_(_dot_)+-]+(_at_)[A-Za-z0-9_(_dot_)+-]+
$MATCH =~ s/\w.*\@//;
* ? grep -i "$MATCH" $BLACK
trash

I know that is actually perl but didn't know what else to try.

Well, not PERL, that's for sure. Procmail isn't perl, and it doesn't use perl match assignment constructs. You could extract the From in much the same way as you are now (though as currently spec'd, the domain portion would never end with anything other than an alpha), then run a second condition also using the match construct which matches from the beginning out for as long as NOT @:

* MATCH ?? ^\/[^(_at_)]+

Domain extraction would instead be like:

* MATCH ?? @\/.*

If you follow the link in my .sig and check out my sandbox (and before you ask, it's explained in those pages) -- in there, you'll find a few lines which take an address, clean it up (= no comments), and then snap it into domain and localaddr portions - search for CLEANFROM, and you'll be right on top of it -- the localpart extraction is pretty much just like above (with the exception of the variablename used), though the initial From: extraction is much different, as the method you're using can easily be tripped up by addresses with commments that APPEAR to be addresses:

        "Joe(_at_)home" <billyjoebob(_at_)somedomain(_dot_)tld>

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