OS X Mavericks 10.9 Server 3 ships with SpamAssassin, but there are almost no controls available to admins (shame on you, Apple). Of course, a well-trained Bayes spam filter will cut down on annoying spam messages.
Thanks to the good folks at topicdesk.com, it’s super easy to set up the server for training the onboard SpamAssassin bayesian spam filter.
The basis of the system is to create two email accounts, the first for storing known junk mail (SPAM), the second for storing mail that was incorrectly marked as junk (HAM) by the bayesian filter.
On the server, set up local accounts named “junkmail” and “notjunkmail”. Turn off all services except email for these accounts for security’s sake.
In your email client, add these two accounts. Set up your rules for processing SPAM so that messages marked as spam are sent to the “junkmail” account’s inbox.
Here’s how my Mail.app is set up:
Now, when junk mail comes in that your email client correctly identifies, it will be automatically placed in the “junkmail” account’s inbox. And when you manually mark a message as junk mail, it will also be moved there. Any miscategorized messages (i.e., not junk mail) can be manually moved into the “notjunkmail” inbox.
But, the magic is using TopicDesk’s spamtrainer. Simply download the package, then install it. From the command line, do the following:
Set up spamtrainer to launch at startup, and run nightly issue the following command. When prompted for the name of your email store and the two SPAM and HAM accounts, just accept the defaults. I chose to have a report emailed to me nightly, and to have the email stored in the SPAM and HAM accounts deleted.
sudo /usr/sbin/spamtrainer -i
At the end of the script run, copy the command it provides and execute it to force spamtrainer to run immediately.
For me, it added the following to a plist that runs nightly at 3 a.m.:
/usr/sbin/spamtrainer -m email@example.com -d -l
That’s it! You’re on your way to less email.