At 07:09 2008-07-07 -0700, Jim Seavey wrote:
I want to filter this stuff to /dev/null and have been working on the
following recipe to do that, alas, to no avail.
It REALLY helps if you write out in English what it is you expect the
conditions to accomplish, rather than dumping a recipe and saying "this
doesn't work". Also, you should enable VERBOSE logging so you can see what
Procmail thinks.
# Kill specific email
:0
* ^From:[ ]*(intl\.paypal\.com|\
chaseonline\.chase\.com)|\
That's a CONTINUATION you have at the end of that line, so the NEXT line
isn't a separate condition, it is parsed as part of this. Lose the trailing |\
* ^Subject:[ ]*(\<penis?\>|\
\<porn?\>|\
\<viagra?\>|\
\<watches?\>|\
\<xxx?\>|\
\<jwseavey?\>|\
\<verna?\>|\
\<joanreitz?\>|\
\<genereitz?\>)|\
Again, a continuation. Since each and every one of the keywords you're
matching for is encapsulated with the same delimiters, you could simplify
as well.
* ^Subject:[ ]*\<(penis|porn|viagra|watches|xxx|\
jwseavey|verna|joanreitz|genereitz)\>
You also want to reconsider the ? you have trailing each of those keywords
- that makes the immediatley preceeding token OPTIONAL (zero or one). So,
in effect, anything with por (for starters) would match. Since this is
anchored to the start of the subject (after whitespace only), and with word
breaks on either side of the keyword, the risks of false positives aren't
as great, but surely this wasn't the plan?
* ^To:[ ]*To:
Like, HUH? Please parse that one out to an english description of what
you're trying to match.
Discounting the continuations which don't belong, and the weird To:, you do
realize that ALL of these conditions would need to be met in order for a
message to be matched? I suspect you're looking to flag based on ANY of them.
/dev/null
Might I suggest that you START with flagging something in the log, rather
than sending things to the ether, because when something goes wrong, you
won't have any email.
So, here's a rewrite based on what I *THINK* you're trying to
accomplish. I haven't run this - it's just off the cuff here in this reply:
:0:
* 1^0 ^From:[ ]*(intl\.paypal\.com|\
chaseonline\.chase\.com)
* 1^0 ^Subject:[ ]*\<(penis|porn|viagra|watches|xxx|\
jwseavey|verna|joanreitz|genereitz)\>
* 1^0 ^To:[ ]*$
* 1^0 ! ^To:
spew.mbx
This uses SCORING - the 1^0 syntax stuff (see 'man procmailsc'), so that
each of the conditions is an OR, though the nominal value being used for
scoring means that each condition will still be evaluated, so a VERBOSE log
will show you how many of them match something. It eliminates the bogus
continuations, simplifies the Subject keyword matching, and Expands the To:
condition you had to try to encapsulate both possible conditions you may
have been trying to match - an EMPTY To:, and an ABSENT To:. Finally, the
messages which match are deposited into a spew mailbox - handy in the event
that you discover there is a major flaw in the logic and you've
false-pozzied on a job offer...
---
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