Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Tips and Tricks _ Filtering Spam With Evolution And Spamassassin

Posted by: hughesjr Nov 23 2003, 02:08 PM

This covers how to filter SPAM using Ximian Evolution and Spam Assassin on a GNU/Linux Distro. It is for users who retrieve their E-mail from their ISP (using Ximian Evolution as their e-mail client) and don't have the ability to setup their E-mail server to use Spam Assassin.

(Administrator's who run a Linux e-mail solution should see the http://www.mirror.ac.uk/sites/spamassassin.taint.org/spamassassin.org/index.html website to setup SpamAssassin with an MTA.)
----------------------------------------------------------------------------------------
First, you need to have http://www.ximian.com/products/evolution/ installed on your system. Almost every recent distrubution of GNU/Linux has a copy of Evolution included. Install the version for your distro. These instructions should work for any version of Evolution greater than 1.2. Set up your mail account using the http://support.ximian.com/cgi-bin/ximian.cfg/php/enduser/std_alp.php?p_search_text=&p_prod_lvl1=2 provided by Ximian.

Next, you need to http://www.mirror.ac.uk/sites/spamassassin.taint.org/spamassassin.org/downloads.html the latest version of SpamAssassin and http://www.mirror.ac.uk/sites/spamassassin.taint.org/spamassassin.org/full/2.6x/dist/INSTALL it. Most recent distributions of GNU/Linux also contain Spam Assassin.

Once you have good install of SpamAssassin, use this http://www.yrex.com/spam/spamconfig.php to make a new /etc/mail/spamassassin/local.cf for system wide mail ... you can also use the file generated by the configuration tool in your ~user/.spamassassin/user_prefs file (where user is your login ID for the linux system) if you don't have write access to /etc/mail/spamassassin/.

Once you have a good configuration for Spam Assassin, we need to figure out where the execuable is on your system by using the command (in a terminal window):

which spamassassin

The result on my Debian SID intallation was:

/usr/bin/spamassassin

Your location may be different....

Now we need to create text file using your favorite editor ... and add the following line in the file:

/usr/bin/spamassassin -e

(you will need to substitute your actual path obtained above for /usr/bin/spamassassin)

Now, save the file to a location where you can execute it. If you want other users to execute this as well, place it into a location that they also have access to. As the root user, I saved my file as /usr/local/bin/spam-filter.sh.

Now we need to change the mode of the file so it can be executed .... use this command:

chmod 755 /usr/local/bin/spam-filter.sh

(if you choose another path, substitute it for /usr/local/bin/spam-filter.sh)

Now, open Evolution and select Tools from the menu then select Filters. Now click the Add button.

In the name block, type what you would like to name the filter ... I used FilterSpam.

In the If block, click the first dropdown box (usually it defaults to sender) and select Pipe Message to Shell Command. Enter the full path to your spam-filter.sh file (in my case /usr/local/bin/spam-filter.sh) for the shell command .

In the second box (default is normally contains) select Does Not Return.

In the third block (a text box) type the number 0.

Now, in the Then block, select the option you want ... I picked Move to Folder and clicked on <click here to select folder> and created a new folder called SPAM.

(you could also select delete instead of move to folder ... I just move the e-mails and delete them later ... sometimes a mail I want to keep gets in there...).

Now you should be filtering SPAM...

You may have some items that get filtered that you want to keep...or some that stay in your inbox that you want removed. In the file ~user/.spamassassin/user_prefs (substitute your login ID for user) you can add a blacklist_from entry to filter mail that stayed in your inbox and a whitelist_from entry to allow mail that was accidentially filtered.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)