On Sat, Feb 21, 2004 at 04:38:01PM -0500, Robert Krueger wrote:
Sometimes it works, sometimes not. Is there a problem with how I've
coded it?
0 HB:
* ([Vv]iagra|[Ss]ex|[Cc]ialas|[Ss]hit)
$MAILDIR\red-spam
Yes, there are some problems.
First of all, procmail is not case-sensitive unless you explicitly
tell it to be so, so you don't need your [Vv] classes and so on.
Second of all, there is a known bug in procmail such that once you
set the H flag in the initial line of a recipe, you can't turn it
off again subsequently. So use the alternative syntax:
:0:
* HB ?? condition
action
Third, you are way overbroad on blocking, since you have not considered
word boundaries or legitimate uses of words. (You might not even see
your own post or this answer.) For instance, here's a non-exhaustive
list of some English words that contain "s h i t" (which I wrote that
way so you might at least have a chance of seeing this):
Bereshith
brushite
Cushite
Cushitic
Elkoshite
Girgashite
Kaneshite
Koreishite
mackintoshite
marshite
metabrushite
shita
shitepoke
shither
shittah
shittim
shittimwood
Washita
And remind me never to invite you to Essex, England.
(Read over "man procmailrc" and notice the '\<' and '\>'
tokens, so you at least can limit the ends of the words.)
Even so, however, banning those words from all email is
just too broad. And why are you looking for them all
anywhere in the *headers* as well as the body?
Fourth, $MAILDIR is not a location in procmail; it is a
process. It is equivalent to the "chdir" command in the
Unix shell. You don't want it as part of the explicit
path to a file or directory location.
Fifth, the backslash is for DOS/Windows, not Unix, which uses
a regular ("forward") slash.
The other question is how can I tell Procmail to filter out any
messages delivered to multiple addresses? For example, the jokes that
are sent around to 49 different people, all listed as the recipient.
That's something covered here from time to time, meaning a survey
of the searchable archives would do wonders. But here's a quickie:
LIMIT = 3 # set your own number
MATCH
:0
* ^To:\/.*
* 1^1 MATCH ?? @
* ^Cc:\/.*
* 1^1 MATCH ?? @
* $ -$LIMIT^0
red-spam
--
dman
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail