procmail
[Top] [All Lists]

Re: Procmail Newbie

2004-10-18 01:20:18
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


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

<Prev in Thread] Current Thread [Next in Thread>