Classnotes | UNIX03 | RecentChanges | Preferences No diff available--this is the first major revision.
(no other diffs)One of the last steps we need to do is setup our SpamAssassin learning system. As you've seen SA will automatically add very SPAMMY or NOT-SPAMMY messages to its Bayesian database. In addition to that, we want to give our users the opportunity to help fine-tune the system. Remember the spam and notspam accounts that we setup earlier? Well this is where we put them to use.
First, a little explanation. When a user sends an email message to email@example.com (substitute your server's name), it will be delivered to a single mbox file, in this case /var/mail/spam. Mail to firstname.lastname@example.org will be delivered to /var/mail/notspam. Once a day (or more if you want), we want the system to read in all the email in these mbox files and add them to the Bayesian statistics database. To accomplish this, we'll write a script and call it using cron.
Create a file using your text editor and call it /usr/local/sbin/my-sa-learn.sh. Cut and paste the following commands into this file:
if [ -e /var/mail/spam ]; then
/usr/bin/sa-learn --spam -p /var/lib/amavis/.spamassassin/user_prefs --mbox /var/mail/spam
rm /var/mail/spam > /dev/null
if [ -e /var/mail/notspam ]; then
/usr/bin/sa-learn --ham -p /var/lib/amavis/.spamassassin/user_prefs --mbox /var/mail/notspam
rm /var/mail/notspam > /dev/null