Petit Manan Lighthouse, off the Maine coast

Menu:

SpamAssassin at umcs.maine.edu

SpamAssassin

SpamAssassin

All e-mail sent to the Computer Science Department is filtered by a program called SpamAssassin.

The way the SpamAssassin works is that each incoming e-mail is examined by the filter which identifies individual characteristics common to spam (unsolicited marketing e-mail) and assigns each of them a rating based on how "spammy" that characteristic is. Once a certain amount of points is reached, the mail is marked as spam.

The default setting is to delete all mail marked as spam.

Configuring SpamAssassin

If you wish to receive spam you can go to your home directory and delete your .procmailrc file. All email (spam and otherwise) will be delivered to you. Mail that SpamAssasin thinks is spam will have the label **SPAM** added to the subject line.

You may want to receive spam but have it go to a separate mailbox that you can check occasionally. To do this you will need to create the following .procmailrc file in your home directory. It will save spam mail to mailbox named 'spam'.

  • Insert the following:

    MAILDIR=$HOME/Mail
    :0:
    * ^X-Spam-Flag: YES
    spam

     
  • Mail marked as spam can be read with the -f Mail/spam flag to your mail program
  • Creating a personal "whitelist"

    To ensure that SpamAssassin does not label e-mails from specific people that you consider legitimate e-mail as spam do the following:

    1. Using your favorite editor (emacs, vi, pico, etc.) open up .spamassassin/user_prefs in your home directory
    2. Find the lines that say:

      # Whitelist and blacklist addresses are now file-glob-style patterns, so
      # "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
      # whitelist_from someone@somewhere.com

       
    3. Under these lines add a line such as the following for each person you wish to receive e-mail from unlabeled by SpamAssassin:
       
      • whitelist_from myfriend@aplace.cs.edu
      • change myfriend@aplace.cs.edu to a real e-mail address
         
    4. Save the changes to the file

    Creating a personal "blacklist"

    If you find yourself constantly receiving spam from a specific e-mail address that is getting through the spam filter you can put them on your "blacklist". A blacklist is a list of e-mail addresses which send spam which are normally not caught by SpamAssassin. If an e-mail is received from an e-mail address in the blacklist it will be marked as spam.

    To create a blacklist do the following:

    1. Using your favorite editor (emacs, vi, pico, etc.) open up .spamassassin/user_prefs in your home directory
    2. Find the lines that say:

      # Whitelist and blacklist addresses are now file-glob-style patterns, so
      #"friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
      # whitelist_from someone@somewhere.com

       
    3. Under these lines and after any whitelist entries you may have add a line such as the following for each person you receive e-mail from that you would like marked as spam by SpamAssassin:

      blacklist_from spammer@spamcity.com (change spammer@spamcity.com to a real e-mail address)
       
    4. Save the changes to the file

    Training SpamAssassin

    Recent versions of SpamAssassin include a Bayesian learning filter with which you can train SpamAssassin with your collection of non-spam and spam. This will make it more accurate for your incoming mail. You can do this using the sa-learn command. In order to use this you will first need to redirect tagged spam to another folder as described above and then do the following:

    For Pine Users:

    Start from pine's main menu.

    1. Press L for Folder List
    2. Press A to Add a New Folder
    3. Name the folder "spam-train"
    4. Open your INBOX in Pine. For each spam that wasn't tagged as such by SpamAssassin, save it to your spam-train folder. Ensure that your INBOX is free of spam then exit Pine.
    5. Run the following commands:
      sa-learn --mbox --spam ~/mail/spam-train
      sa-learn --mbox --ham /var/mail/$username (replace $username with your username)

    Depending oh how much spam you get that isn't marked as such by SpamAssassin you should do steps 4 and 5 daily or weekly. Note that SpamAssassin will remember what mails it's learnt from, so you can re-run this as often as you like.

    For Users of Other Mail Programs: The concepts are similar to what is done in Pine, you make a mail folder for spam not caught by SpamAssassin. Move all those messages from your inbox to that folder and then run "sa-learn --mbox --spam" on your spam training folder and "sa-learn --mbox -nonspam" on your inbox