Training SpamAssassin

Training SpamAssassin

Spamassassin has the ability to "learn" what is spam along with what is not spam with the sa-learn command.
http://spamassassin.apache.org/full/2.6x/dist/doc/sa-learn.html

Simple example.

  • Make sure you have spamassassin running for you and some spam is being trapped. Learn How Here
  • Create a mailbox folder with your IMAP client called salearn.
    (creates a file in /user/<username>/salearn or /user/<username>/Mail/salearn depending on your IMAP client setup. Make sure you know this for a later step)
  • Move undetected spam from your inbox to salearn. This will build up.
  • Depending on your volume, the next step could be every few days at first or a few weeks.
  • SSH to arctic and run the command: sa-learn --spam --mbox /user/<username>/Mail/salearn
  • This tweaks the spam filters to learn from the file salearn.
  • If you use mh mail (each email is a number under a directory), then ignore the --mbox argument.
  • The results will output how many emails were examined and the number of messages it learned from.
  • You can clear out the salearn mailbox and start over.

Use this simple example to tweek the spam filter. For better results, teach it non-spam.

  • Be sure to clear out all spam from your inbox.
  • Be sure to know the location of your inbox (/var/mail/<username>, /user/<username>/mbox, other depending on your unique setup)
  • "ls -l" those locations to find the latest time stamp, the directory with the most recent timestamp is your inbox.
  • SSH to arctic and run the command: sa-learn --ham --mbox /var/mail/<username>
    (notice: --ham instead of --spam)
  • Output will be similar to previous example.

 
Link To CSE Sourses Link To CSE Student Home Pages Link To CSE Facilities Link To CSE Help Page Link To CSE Calendar


3115 Engineering Building
East Lansing, MI 48824-1226
Phone: (517) 353-3148
Fax: (517) 432-1061
web@cse.msu.edu