I'm trying to write a recipe that has several blocks which check for
certain spam conditions, added by spamassassin and dspam. When those
conditions are met, it should
1. Add a header to the email which tells me what rule filed the email
so I won't have to go through the logs
2. Deliver the message
3. Mark it read
4. Learn it with sa-learn as spam
I think I have tried every combination placement and header options, but
I haven't nailed the right combination just yet. Perhaps one of you
smart readers can help me?
Here's where I am now. This actually does everything it's supposed to,
but I get extra emails from all the extra clonings (sometimes a message
may meet the conditions of more than one block).
:0c
* ^X-Spam-Status:.*autolearn=no
* ^X-Spam-Status:.*BAYES_99
* ^X-DSPAM-Result: Spam
{
foldername=Spam-Archive
#add the header
:0fhw:formail.lock
|/usr/bin/formail -A "X-Procmail-Rule: spamassassin autolearn=no,
BAYES_99 and dspam-result=spam"
#delivers to foldername/new
:0c:
.$foldername/
#moves it to foldername/cur and marks it read
:0
* LASTFOLDER ?? /\/[^/]+$
{ tail = $MATCH }
TRAP = "mv $LASTFOLDER .$foldername/cur/$tail:2,S"
HOST
}
#since it wasn't learned by bayes to be spam, learn it now
:0aw:sa-learn.lock
{
|/usr/bin/sa-learn --spam -p
/home/peloruso/.spamassassin/skip/user_prefs
--siteconfigpath=/home/peloruso/etc/mail/spamassassin/skip
}
:0c
* ^X-Spam-Status:.*autolearn=no
* ^X-Spam-Status:.*URIBL_JP_SURBL
* ^X-DSPAM-Result: Spam
{
foldername=Spam-Archive
:0fhw:formail.lock
|/usr/bin/formail -A "X-Procmail-Rule: spamassassin autolearn=no,
URIBL_JP_SURBL and dspam-result=spam"
:0c:
.$foldername/
:0
* LASTFOLDER ?? /\/[^/]+$
{ tail = $MATCH }
TRAP = "mv $LASTFOLDER .$foldername/cur/$tail:2,S"
HOST
}
:0aw:sa-learn.lock
{
|/usr/bin/sa-learn --spam -p
/home/peloruso/.spamassassin/skip/user_prefs
--siteconfigpath=/home/peloruso/etc/mail/spamassassin/skip
}
This is just two blocks from my procmailrc--I have several more just
like it with different tests at the top. And of course, at the end of
all of these, I have default rules, and since there's always a clone
left over, it often fires those rules too. By the way, this is just one
of many configurations I have tried. I have it set up like this right
now because I tried putting the sa-learn command in the block with the
rest of the commands, and it always mangled up my headers, or simply
didn't work. And I have to have the clone on the bigger block so that
there is a copy to feed the sa-learn. I don't know. Maybe I'm missing
something obvious. Show me the way! :)
Skip
--
Get my PGP Public key here:
http://pelorus.org/skip(_at_)pelorus(_dot_)org_public_key(_dot_)asc
____________________________________________________________
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