How to use SpamAssassin bayesian filters?

BlueNoteWeb

Verified User
Joined
Nov 4, 2004
Messages
52
Location
Denton, TX
I'm probably just completely overlooking something - hopefully someone can help me out on this.

I've installed SpamAssassin on my server following the instructions here:

http://help.directadmin.com/item.php?id=36

It's working pretty well. Incoming emails are scanned, some are marked as spam and they're moved to the user's spam folder as per the settings.

The next step is the bayesian filter - how do I teach SA what's spam and what's not? If I move a message from my inbox to my spam folder, will that do it, or is there another step to take?
 
You either need to manually train it using sa-learn from the command line, or you can configure it to train based on the contents of an IMAP folder as part of a cron job (harder). If the spam has been forwarded to you then this gets much harder!

I don't have the time at the moment to go through this in detail but would suggest you start by reading the entire spamassassin wiki (preferably twice) and then have a good browse through the spamassassin forum / mailing list.

http://wiki.apache.org/spamassassin/

http://www.nabble.com/SpamAssassin-f191.html
 
This should run sa-learn on all the spam in your users folders
Code:
 for i in `find /home/ -type d -name .INBOX.spam`; do sa-learn --spam $i/cur; sa-learn --spam $i/new;done
 
This should run sa-learn on all the spam in your users folders
Code:
 for i in `find /home/ -type d -name .INBOX.spam`; do sa-learn --spam $i/cur; sa-learn --spam $i/new;done

this is slightly better

Code:
 for i in `find /home/ -type d -name .INBOX.spam`; do sa-learn --spam $i/{cur,new};done
... prolly should use xargs instead of a for loop
 
this is slightly better

Code:
 for i in `find /home/ -type d -name .INBOX.spam`; do sa-learn --spam $i/{cur,new};done
... prolly should use xargs instead of a for loop

ah xargs
Code:
find /home/ -type d -wholename */.INBOX.spam/cur -o -wholename */.INBOX.spam/new | xargs sa-learn --spam
or
Code:
find /home/ -type d \( -wholename */.INBOX.spam/cur -o -wholename */.INBOX.spam/new \) | xargs sa-learn --spam
 
Back
Top