Spamassassin with auto-learning

Recipe for spamassassin with auto-learning. It’s a little bit clumsy but it works. Interested in feedback from other geeks who have played with spamassassin on how to make it more streamlined.

Here is how I have spamassassin set up on pop1

1. .procmailrc edited for the following:


:0 c

# SPAMCOP FILTERING (only if size < 256 k)

:0fw: spamassassin.lock
* vi /udir/gconnor/crontab.gconnor
05 03 * * * /udir/gconnor/bin/spamlearner

> crontab /udir/gconnor/crontab.gconnor

> vi /udir/gconnor/bin/spamlearner
sa-learn –ham –mbox mail/Spam/missed-not-spam
sa-learn –spam –mbox mail/Spam/missed-spam

> chmod +x /udir/gconnor/bin/spamlearner

> /udir/gconnor/bin/spamlearner
Learned from 0 message(s) (0 message(s) examined).
Learned from 0 message(s) (0 message(s) examined).

After this runs correctly for a few days, alter crontab to send stdout to null.

4. If spamassassin learns something incorrectly, remove it from the “learned” folder and place it in the “missed” folder.

Incorrectly learned as good:
Spam/track-learned-not-spam -> Spam/missed-spam

Incorrectly learned as spam:
Spam/track-learned-spam -> Spam/missed-not-spam

5. Periodically look at the “unlearned” folder and place stuff in missed-spam or missed-not-spam to be learned.

6. Periodically trim the missed-spam and missed-not-spam folders to make sa-learn faster. Run spamlearner again to catch any changes you made today, then move all missed-spam to learned-spam and missed-not-spam to learned-not-spam.

Leave a Reply