Spamassassin

SpamAssassin is a tool used for tagging and optionally deleting spam as it arrives. It works pretty well. It's available on rootaction.net and here is how to set it up from your shell account.

Installation

For your account, you need to create .forward and .procmailrc files. Your ~/.forward file must contain exactly the following text:

"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #user"

Your ~/.procmailrc must contain exactly this text:

:0fw
| /usr/bin/spamassassin

Both files must be mode 600 and owned by you. They will be owned by you if you create them. To set the permissions to mode 600, run this command:

chmod 600 ~/.procmailrc ~/.forward

Filtering your spam to a separate folder

I expect most people grab their mail via POP today. For POP users, you will need to learn to use your mail programs built in filter. Filter either on "SPAM" in the subject field or on the "X-Spam-Status: Yes" field value.

Spam Assassin always does the wrong thing with mail from this address...

After SpamAssassin has run once (your first mail after installation) you will have a file named ~/.spamassassin/user_prefs which you can edit. You can place entries in the file to either blacklist (disallow) or whitelist (allow). Withthis feature, you can control how mail from certain addresses is always treated. There are examples in the file that should get you started. Here's another, in which comments are included on lines starting with "#" and any other line is a control element.

# SpamAssassin user preferences file.  See 'man Mail::SpamAssassin::Conf' for
# details of what can be tweaked.
#*
#* Note: this file is not read by SpamAssassin until copied into the user
#* directory. At runtime, if a user has no preferences in their home directory
#* already, it will be copied for them, allowing them to perform personalised
#* customisation.  If you want to make changes to the site-wide defaults,
#* create a file in /etc/spamassassin or /etc/mail/spamassassin instead.
###########################################################################

# How many hits before a mail is considered spam.
# required_hits               5

# 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
whitelist_from myfriend@hotmail.com

blacklist_from offers@somespammingcompany.com

More extensive information on whitelist and blacklist and the user_prefs file is available in the official documentation.