Everyone hates spam, and one of the main ways that people are fighting it is through the use of SpamAssassin. I’ve been using it for a while now and have Sieve detecting spam headers and moving them to my Junk folder.
Dealing with spam that went unrecognized has been more of a manual process. Every once in a while, I’d have to segregate all of my useful mail from the spam and run “sa-learn” on the leftovers. This isn’t horrible, because I tend to shell into my server fairly frequently, but I really prefer to have menial tasks like this automated.
First of all, I created a folder in my mailbox called “Unrecognized Spam”. The name isn’t important, really. It just needs to be a place to file away all of those messages that SpamAssassin didn’t catch on the way in.
Once that was done, I wrote a very simple little script, which I dropped in /etc/cron.daily/: