procmail
[Top] [All Lists]

Re: Two small questions / problems

2004-02-21 18:09:48
On Sat, 2004-02-21 at 17:40, Dallman Ross wrote:
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

   Ah, yes, I remember seeing this alternative somewhere.  I got the
first version from my Procmail book.

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

Yes, I see your point.


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

  That was an oops, sorry to say..


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


Here's the last email I got, FWIW, that illustrates my question:

///////////////////////////////////////////////

Buy Viagra and Cialas Aka "Super Viagra"..The Viagra that last all
weekend!.. and other popular medications. Next-Day Fedex
....here at .. http://www.completepillpalace.com?rid=1000   


need is shit will like shit the Don't of that  

///////////////////////////////////////////////

I haven't got a clue as to what this idiot was trying to say in the last
line, but I'm surprised that SA didn't catch this style of email.
Also, the "To:" line had about 10 different addresses.

Thanks for your help,
Robert

Attachment: signature.asc
Description: This is a digitally signed message part

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