The spam filtering walk-through

Find a shell account (try this site to get a hint on free accounts) that provides an email address and the following applications:
* spamassassin (NOTE: If spamassassin is not available you'll have to do with Razor alone - see this page for a HOWTO)
* formail
* procmail
* postfix

Install Vipul's Razor:
* Download the latest razor-agents package from here to your homedir (eg use wget)
* Go to the folder of razor-agents-x.xx and decompress and untar the razor file (tar xvzf razor-agents-x.xx)
* Change directory to your home dir and run the compilation of the package as follows:

- perl Makefile.PL PREFIX=/home/XXXX/perl5 [NOTE: Replace the XXXX with your account name]
- make
- make test
- make install

The run:
- razor-client
- razor-admin -create
- razor-admin -discover
- razor-admin -register [NOTE: It should then say "Register successful...". (You may need to enter the last command a couple times to reach the registration server; if it says "Error 202", try "razor-admin -register" again.)]
* Edit your .cshrc file (placed in your homedir) to include these lines:
setenv PATH /home/XXXX/perl5/bin:${PATH}
setenv PERL5LIB /home/XXXX/perl5/libdata
setenv MANPATH /home/XXXX/perl5/man:${MANPATH}

Create the following files and directories:

~/mail (a directory) NOTE: This directory is normally created with the shell account. If so - leave it as it is.
~/.procmail (a directory)
~/.spamassassin (a directory)

1. ~/.forward (a text file)
2. ~/.procmailrc (a text file)
3. ~/.procmail/spam.rc (a text file)
4. ~/.spamassassin/user_prefs (a text file)

Edit the files you've created as follows:

1. ~/.forward

2. ~/.procmailrc

## Set to yes when debugging
VERBOSE=no ## I'm assuming that you are using pine, which means that your mail is
## stored in "~/mail". If not, figure out where your mail is stored
## (for example, "~/Mail" or "~/.mail" or "~/.Mail"), and set MAILDIR
## to that directory.

## Directory for storing procmail-related files

## Put '#' before LOGFILE if you want no logging (not recommended)

## filter spam

3. ~/.procmail/spam.rc
:0fw: spamassassin.lock
| /usr/bin/spamc

# First of all messages are tested against Vipul's Razor spamlist
# via the razor-check command. If messages are on the Razor list
# the subject line will be tagged with *****SPAM*****

#Razor check
:0 Wc
| razor-check
:0 Waf
| formail -i "Subject: *****SPAM***Razor-listed*****"

# Secondly procmail forwards messages tagged as spam to an email
# account called "". Non-spam messages are
# also forwarded to the address, but are not tagged by spamassassin
# with *****SPAM*****.
# If you want mail to stay in your inbox, just delete the lines.


4. ~/.spamassassin/user_prefs
# SpamAssassin user preferences file. See 'man Mail::SpamAssassin::Conf' for
# details of what can be tweaked.

# score needed to deem an email to be spam. the lower the score, the
# more likely the email will be classified as spam. default is 5, but
# I have found that 4 works a little bit better
required_hits 5

# if you find an email from an address classified as spam that should
# *never* be classified as spam, add it to the whitelist
whitelist_from *

# if you receive an email from an address that will always be spam, add
# it to the blacklist (comma separated)

# Whitelist and blacklist addresses are now file-glob-style patterns, so
# "", "*", or "*" will all work.

# append the subject line with "[SPAM]"
# if you do not want the subject line altered, just remove this line
subject_tag [SPAM]

This walkthrough is hugely inspired by Duke Hutching's work on the matter and Spamassassin's Wiki.

Back to

"C Squared Studios/Photodisc Green/Getty Images"