sa-learn - train SpamAssassin's Bayesian classifier


This page is the manpage for sa-learn. However, I usually find myself reinventing the process I go through to train SpamAssassin every time I want to do it, so here’s a summary of what I do. You might find it useful; you might not. I, on the other hand, most certainly will.

First, I usually move mail messages that misses into a mailbox somewhere. I also move the items it determines are Junk into that same mailbox.

Second, I archive that mailbox to a directory on my server, so there end up being one or more .mbox files in that directory. That directory is shared by the server, so it’s no trick to archive the mailboxes straight from to the server.

Third, I login to the server and cd to the directory containing the mbox files and do the following:

$ sudo sa-learn --forget --mbox *
$ sudo sa-learn --spam --mbox *

I guess I use the former command to make sure that SA forgets whatever it knew (or I thought it knew) about the messages. The second teaches the filter.

That’s it! Now, next time I want to do this process again, all I will have to do is search my own blog and won’t have to reinvent the wheel.

Recent Comments