Maildir and SA Bayes

Mike Kercher mike at CAMAROSS.NET
Thu Oct 2 05:26:58 IST 2003

I got this in a Linux Journal newsletter. Thought I'd share it.

   If you use Maildir mailboxes, in which each mailbox is a directory and
   not a file, there's an easy way to train SpamAssassin's Bayesian
   filter on your spam messages. First, save all spam messages to a
   folder called spam, from your mailer. Then run this script:



mv $SPAMBOX/new/* $SPAMBOX/cur &> /dev/null || exit 0

ls $SPAMBOX/cur/* | xargs sa-learn --file --spam --showdots

rm $HOME/Maildir/spam/cur/*

# end script

   This should work from a cron job, because newly saved Maildir messages
   are placed in the new subdirectory. The exit 0 ends the script if
   there is no spam to be examined.


More information about the MailScanner mailing list