Deleting Spam With My Eyes Wide Shut


I've been a long time user of SpamAssassin, but hadn't updated it for some time. About 6 weeks ago, I updated it to the latest version, which includes a Baysian filter. I spent some time making sure I correctly classified Junk and other mail and trained it regularly. For the last three weeks I've been checking my junk folder to ensure it didn't throw things away I wanted and I didn't find anything. Nothing. It lets a few things through, especially when its of a type it hasn't seen before, but after training again, that goes away. So today, I took the plunge and deleted over 1000 items in my Junk folder without even looking at them. Wow!

I read mail on my Ti-Book but filter on my mail server. So, I actually train on the Mac and then transfer the results to my server using this script:

#!/bin/sh
SA_LEARN=$HOME/pkgs/Mail-SpamAssassin-2.63/sa-learn
JUNK="$HOME/Library/Mail/POP-pj@pop.windley.org/Junk.mbox/mbox"
DELETED="$HOME/Library/Mail/POP-pj@pop.windley.org/deleted.mbox/mbox"
MAILBOXES=/Users/pjw/Library/Mail/Mailboxes
BAYES_DIR="$HOME/.spamassassin"
SEEN=$BAYES_DIR/bayes_seen
TOKS=$BAYES_DIR/bayes_toks
$SA_LEARN --spam --mbox $JUNK
$SA_LEARN --ham --mbox $DELETED

After that I just scp the files up to my server and it works like a charm. It may seem odd that I only look at my Trash folder as ham. The Trash folder represents the largest collection of fresh email that isn't Spam. I When I first did this I did look at all my other folders with this line:

find $MAILBOXES -name mbox -exec $SA_LEARN --ham --mbox {} \\;

But after running it once, my other folders don't change often enough to do this regularly, so I'll run that line occasionally. I don't want to waste time each day looking at all the other folders and not getting any information from them. There are, of course, a lot of other configurations you might use to get SpamAssassin in the loop, but this one's pretty slick. Between SpamAssassin and the built in features of Os X, I am virtually Spam free.


Please leave comments using the Hypothes.is sidebar.

Last modified: Thu Oct 10 12:47:20 2019.