by Frank Rietta, 5/24/2003
E-mail has become essential to me, even more important then my telephone. Hardly a day passes in which I do not exchange e-mail with numerous colleagues, customers, friends, and family. However, working with e-mail has become increasingly difficult as the volume of junk e-mail I receive has increased exponentially. For every legitimate piece of mail, I receive ten spams – and I am, frankly, fed up.
I have had very good experiences with SpamAssassin and Razor (Windows users should really take a look at www.cloudmark.com, which uses the Razor network). I use Ximian Evolution, an Outlook-like program, to read e-mail on my laptop, which is running Red Hat Linux. It is fairly easy to get Evolution to filter incoming messages through SpamAssassin and automatically move the offending junk mails to a special “Spam” folder, which can periodically be reviewed for any trapped legitimate mail.
Other authors have written about using SpamAssassin on a mail server or passing messages through procmail when working with other mail clients. Some links are included at the end of this article.
Prerequisites
Creating a Spam Filter Rule in Ximian Evolution
Performance Issues
Brief Overview of Installing SpamAssassin and Razor
Other Sources of Information
About the Author
Linux, FreeBSD, OpenBSD, or another Unix variant.
Ximian Evolution e-mail client, www.ximian.com.
SpamAssassin, www.spamassassin.org.
Vipul's Razor is optional, but works well in conjunction with SpamAssassin. Best of all, SpamAssassin accesses Razor by default if it is installed on the computer, so there is little extra configuration, razor.sourceforge.net.
Create a filter in Evolution to pipe the message content to “spamassassin -e > /dev/null” and move it to a spam folder if the return value is greater than 0. You will want to add a “Stop processing” action after the move action in the filter rules. Be sure to move the new spam rule to the top of the rule list.
Create a Spam Folder
Go to Tools->Filters
Under Filter Rules, choose the “Add” button.
In the Add Rule dialog:
Under the Criterion, “IF,” frame.
Choose a rule name, I chose “spam”
Choose “Pipe Message to Shell Command” from the condition drop down list.
In the command text box put: “ spamassassin -e > /dev/null”
Select “returns greater than” from the return drop down list.
Set 0 to the number box.
Under the Action, “THEN,” frame.
Choose the Move action and set the destination to your new spam folder.
Click the “Add Criterion” button.
Choose “Stop processing”
from the new action list.
Finally, Move the new Spam rule to the top of the filter list. Ximian Evolution processes filter rules sequentially.

Heuristic checking is computationally expensive, which means it takes a lot of processor cycles to complete. No matter how fast your computer is, adding spam filtering will slow down your mail download significantly. However, depending on the volume of mail you receive, adding the filtering will significantly reduce the headaches of dealing with the junk mail.
If you are running the “spamd” daemon from SpamAssassin, you can use “spamc” in the filter settings instead of “spamassassin.” This may speed things up slightly as it keeps from loading a new instance of Perl each time a message needs to be checked.
It has been suggested that placing the spam rule somewhere other than the top of the list may help improve performance for some configurations. Infinite Ink's Mail Filtering FAQ can be found at http://www.ii.com/internet/robots and may be helpful.
Periodically reviewing the spam folder for legitimate mail trapped by the spam filter is a good idea. When using the latest editions of SpamAssassin/Razor, I have had very few false positives.
SpamAssassin is available for download as source, from the Perl CPAN repository, and even from an RPM package provided by Red Hat.
I have always installed SpamAssassin from CPAN. Simply run the following commands at root.
perl -MCPAN -e shell
o conf prerequisites_policy ask
install Mail::SpamAssassin
quit
If you want to simply install the RPM from Red Hat 8, choose SpamAssassin from the mail server options on the CDROM or run the up2date command to download and install:
up2date spamassassin
Read up on SpamAssassin at www.spamassassin.org. It is a very nice program with quite a few features.
Razor, also known as SpamNet, is a peer-to-peer spam filtering network. Unlike SpamAssassin, which runs a set of rules against the message, Razor compares the message to those which other human reviewers have deemed spam. Using Razor will add additional delays to the message scanning, but will also improve the accuracy of the filtering process.
Razor can be downloaded from http://razor.sourceforge.net.
SpamNet, www.cloudmark.com, is a Razor implementation for Microsoft Outlook.
The Razor project is at razor.sourceforge.net.
SpamAssassin is at www.spamassassin.org.
Moshe Jacobson wrote an article, lugatgt.org/articles/procmail, which provides an overview of mail filtering with procmail.
Infinite Ink's Mail Filtering FAQ, www.ii.com/internet/robots, may be helpful when optimizing mail filters in general.
Frank Rietta has been working with Linux for more than three years. He is a developer member of the Association for Shareware Professionals and has served as the President of the Georgia Tech Student Chapter of the Association for Computing Machinery (ACM). Frank is the owner of Rietta Solutions/Atlanta Web Host.