Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Filtering Spam

Spamassassin is an effective tool for filtering out spam email. If your arriving email has already been passed through spamassassin (by your ISP or else through using fetchmail yourself), then you simply have to check for the appropriate header field in the email (i.e., check if X-Span-Flags exists and contains YES). Set up an evolution filter to do this. Select Tools->Filter and click on Add. The search criterion will be to look at a Specific header (X-Spam-Flag) and to check that it contains YES. For the action choose a folder into which the identified spam should be placed (rather than deleting it, just in case spamassassin gets it wrong). Click OK and that's it.

To call spamassassin for use within evolution create a script file (perhaps in /usr/local/bin/spam-filter) with:

  spamassassin -e
The -e option indicates that we should run spamassassin and return an exit code that indicates whether the email looks like spam. Make the script executable with:

  $ chmod u+x /usr/local/bin/spam-filter

Now tell evolution to filter you email with this script. So, create a new filter with Tools->Filter and click on Add. Call the new filter something like `SpamAssassin'. Select `Pipe Message to Shell Command' as the first part of the criteria. Then fill in /usr/local/bin/spam-filter as the command to run. Set `Does Not Return' and `0' for the other fields. For the action choose a folder into which the identified spam should be placed (rather than deleting it, just in case spamassassin gets it wrong). Click OK to close the filter and then OK to close the filter editor. You are now done!


Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.