School of Computing

E-Mail Spam Checking

Introduction

This document describes how to setup Exim Filtering to filter spam into a separate file. This would be useful if your mail client supports .mail-style folders, or if you're using IMAP to read your mail. This is done by examining headers added to the email by the School of Computing spam checking facilities in place on the School of Computing servers.

Warning

Changing your .forward incorrectly can make very odd things happen to your email. The worst case is that you will stop receiving email. So please, if you're unsure about what you're doing, stop here and ask us to help.

Setting up Exim Filter

Each user can have a .forward file which provides filtering rules for Exim. This is used when mail is delivered to the user to tell Exim where the email should be placed. Your .forward file should be in your home directory. Mine is here :-

/home/cur/tdb/.forward

It is important that the .forward file begin with the following line if you intend to do filtering :-

# Exim filter

This example shows how to filter spam to a file named spam in ~/Mail/. This would work well with most IMAP clients that look in that folder for the mail.

if $message_headers: contains "X-UKC-CSSpamCheck-Flag: YES"
then
	save "${home}/Mail/spam"
	seen finish
endif

Now as each email arrives your filter file will check whether it's been flagged as spam, and if so file it in the above named file, and not your inbox. You might want to deliver to a different file. This solution is completely flexible and dependent on the way you setup your mail.

For further information on Exim forward files, please visit the Exim website: http://www.exim.org/exim-html-4.40/doc/html/filter_toc.html

Where to put the spam 'folder'

Although we refer to a spam 'folder', it is actually just a file.

These are suggestions as to where you might want to put your spam 'folder'. You will need to create the parent directory ('mail' or 'Mail'), but not the spam file - the mail system will do this for you.

  • Pine: ${home}/mail/spam
  • Webmail: ${home}/Mail/spam
  • General IMAP: ${home}/Mail/spam

The last one is a suggestion. IMAP will look for these 'folders' anywhere under your home directory if you want. Keeping it under Mail, however, means that it'll still work with webmail.

School of Computing, University of Kent, Canterbury, Kent, CT2 7NF

Enquiries: +44 (0)1227 824180 or contact us.

Last Updated: 07/11/2011 12:46