Hello list, I've been using spamassassin for quite some time both personally and for my customers. I had a client that wanted a way for their users to be able to forward emails that slipped passed the email filters so that they could be learned as spam.
The folks responsible for spamassassin did an excellent job with the sa-learn program to be able to train the filters with bayesian filtering. One of the major drawbacks however is that the users need to have access to the mail server and the sa-learn program... not to mention have any clue how to use it ;) My solution was to create a separate mail user, lets say spam_user, with two mail aliases: is_spam and not_spam. After setting this up, I instructed the users to forward any spam messages they receive to the address [EMAIL PROTECTED] and any incorrectly flagged spam messages or sets of non-spam messages to [EMAIL PROTECTED] . This is where my "Spam Sort" perl script comes in. I placed an entry in cron to call the script which then: -logs in via IMAP as the spam_user -checks all unread messages -determines the type of the message by the "To:" header -splits out each attached message in the forward and copies it as a new message into either an is_spam or not_spam IMAP folder (mostly for tracking purposes to see what was classified as spam/ham) -calls sa-learn with appropriate options on the message -sets processed messages as read -when finished, rebuilds bayes db and permission on db files (if necessary.. as in the case where the scrip is run as root and the files are owned by a user). After writing the script for them I asked and they agreed for me to post the code here for others to use (I myself and the company I contracted to are both big on open source). So anyway, enough babbling, you can get the code here: http://www.mswanson.com/?f=software/spamsort/index.html Software comes with no warranty, blah blah blah (ooops, that's it for babble, I promise). Comments welcome.. obviously there are some features that would be nice to add to the code and I may as time permits. Hope someone finds this useful. It worked wonders for my client (50% spam reduction). Best Regards -- ----------------------------- Marc Swanson MSwanson Consulting Email: [EMAIL PROTECTED] Phone: (603)512-1267 Fax: (603)868-1730 http://www.mswanson.com
