Posts Tagged by Procmail
beat image spam with procmail
| 03-Feb-2007 | Posted by Sonia Hamilton under Procmail |
I blogged a while ago about using FuzzyOcr for detecting image spam. My FuzzyOcr isn’t working and at the moment I haven’t got time to fix it, so I wrote a procmail recipe to solve the problem instead:
# test if body contains gif, html, etc, and get procmail score
:0 Bc
* 3.5^0 Content-Type: image/gif
* 2^0 Content-Type: text/html
/dev/null
SCORE_PM=$=
# pull out SA score and required; if 2 scores > SA req'd, ISGT = 1 (true)
SCORE_SA=`formail -c -xX-Spam-Status: | awk '{print $2}' | awk -F= '{print $2}'`
REQD_SA=`formail -c -xX-Spam-Status: | awk '{print $3}' | awk -F= '{print $2}'`
ISGT=`echo "${SCORE_SA} + ${SCORE_PM} > ${REQD_SA}" | bc -l`
# test if ISGT = 1, if so, spam prob
:0 :
* ISGT ?? ^^1^^
.y_spam_probable/
procmail notes
| 13-Sep-2006 | Posted by Sonia Hamilton under Procmail |
Good procmail sites
- Timo’s procmail tips
- ii.com – procmail quickstart
- procmail tips
- Halcyon guide
- Partmaps procmail FAQ
- Stimpy’s formail tutorial
Procmail commands can consist of…
- a statement
FOO=`formail ... | sed ...`
- a recipe
A recipe consists of three parts…
- a colon line
- zero or more condition lines
- an action section
:0 email_folder/
:0 * From: ... email_folder/
An action is one of…
- a folder
email_folder email_folder/
- a forward
!foo@bar
- a pipe (with :0 fwh or :0 fwb colon flags)
| formail -I ...
- a curly brace
{
Curly Braces
A curly brace starts a nesting block ie a recipe can be:
- a colon line, zero or more conditions, and curly brackets
:0
{
...
}
:0
* From: ...
{
...
}
Inside curly brackets there must be one or more recipes.
How to do if-else
Do if-else using the E colon line flag
:0
{
:0
* ^From: ...
# deliver to default destination (inbox)
${DEFAULT}
}
:0E
{
# else
...
}
Recent Comments
<<EOF>>was eaten...cat <>~/.vi...