School of Computing

E-Mail Spam Checking

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, or use our automated script.

Mh and exmh users: Setting up Exim forward file filtering

The best way to arrange for suspected spam to be refiled into a separate folder if you use mh or exmh is to persuade the mail delivery system (Exim) to refile the messages as they are delivered. But first you'll need an mh folder to hold the suspected spam.

Create a new mh folder called "Spam" by either typing the mh command

/usr/local/packages/nmh/bin/folder -create +Spam
or clicking on New in exmh and typing
Spam
into the popup dialog box.

Now you have an mh folder called Spam you can arrange for messages flagged as spam to be delivered into that folder. This is done using an Exim filter rule.

Exim filter rules are added to a file named ".forward" in your home directory. These rules tell Exim what to do with mail as it's delivered. My .forward file is here on myrtle:

/home/cur/mcw/.forward

If you do not already have a .forward file, it must start with this line:

# Exim filter

Then add this section, either to your existing .forward file, or to a new one. It will save any messages flagged as spam in an mh folder called "Spam".

if $message_headers: contains "X-UKC-CSSpamCheck-Flag: YES"
then
	pipe "/usr/local/packages/nmh/lib/nmh/rcvstore +Spam"
	seen finish
endif

Once your .forward file is in place, all email flagged by SpamAssassin as spam will be delivered directly into your mh folder called Spam.

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

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

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

Last Updated: 12/03/2012 17:01