procmail
[Top] [All Lists]

Re: Procmail Newbie

2004-10-18 23:33:01
On Monday 18 October 2004 13:33, Professional Software Engineering wrote:
At 12:42 2004-10-18 +0545, Bikrant Neupane wrote:
This is something I would like to implement using procmail.  I would like
to read the X-Spam-Score value and compare that value against some
predefined

Isn't this header generally a row of asterisks?

:0:

* ^X-Spam-Level: \*\*\*\*
spam

Would file as spam whenever there's four or more asterisks.

value. Basically what I am trying to implement is to filter Mails based on
X-Spam-Score value. I belive someone has done that before.

Only thing I am not sure is how to do is
1. return value from an external script and save it in procmail variable.
2. Numerica test such as if ( x > 2)

The X-Spam-Status generally has a score= in it:

# (do SA stuff)

# for when SA manages NOT to insert the asterisks...

:0:

* X-Spam-Status: Yes, score=\/[^        ]*
* -3^0
* $ $MATCH^0
spam

Thanks for the reply. But I am still not getting the procmail syntax :( (i 
read the man page too )

As I asked in my first question, How do I run external script and return value 
from it?

What I am trying to do is, let user define their own spam thresold value. You 
have used value 3 which is hardcoded in the procmail script. I want to get it 
from a script and the script will in turn query a database or some flat file.



For now I tried this:
My Spam-assassin heard looks like
X-Spam-Debug-Wlink: -4.9

:0:
* X-Spam-Debug-Wlink:.\/*
* -5^0
* $ $MATCH^0:
 spam

This should catch anything greater than -5 (including -4.9) right?
Thanks a lot

regards,
Bikrant







that -3 is the non-spam threshold - if the (whole number) score is higher
than that, it'll be considered spam.

:0fw
:
| /usr/local/bin/getScore   #i can call script but how to read return
| value??

No need to do this - as shown above, procmail can obtain the value
directly.

:0:

* if [ $ScoreRead >= $MinScore ] #how to implement it in procmail ?
${DIR}.SPAM/

You'd use scoring - 'man procmailsc' -- this is that -3^0 type notation in
the recipe I present above.

:0:

* ^Subject:.gadha
spam

ftr, the sole dot in the subject condition means 'any one character', and
typically we can expect that to be a space or tab, so as written, this
recipe is likely to only match when 'gadha' is the very beginning of the
subject.  I suspect you want an asterisk '*' after the dot, which makes it
a variable number of matched characters.

:0:

*
new

The blank condition line is unnecessary - remove it.  Additionally, you can
set DEFAULT to this mailbox name, and the mail will automatically be
delivered there if processing reaches the bottom of the rcfile without the
message having been delivered.

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

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