Procmail

 

Overview

Procmail (http://www.procmail.org) is a filtering tool which filters email based on regular expression matching. SpamAssassin (http://www.spamassassin.or g) is a mail filter to identify spam. SpamAssassin uses several spam-identi fication tactics and assigns points to an email based upon these tactics. Mail which has reached a threshold point value is labelled as spam. The labelled spa m can then be filtered, via procmail in this case, see filtering for other methods.

Simple Configuration

Create a .procmailrc file in your home directory. The contents of this file should be:

.procmailrc


SHELL=/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin

FROM=`formail -XFrom: -r -xTo: | tr -d ' '`

:0fw
| if [ -x /usr/local/bin/spamc ]; then /usr/local/bin/spamc; fi

:0:
* ^X-Spam-Status: Yes
junk-email

Create the .procmail directory in your home directory.

mkdir .procmail

You mail will now be filtered via procmail and any potential junk-email will be stored in the file junk-email in your home directory.


 

Whitelists

You can define a whitelist which is a list of domains and/or addresses from which email will NEVER be tagged as spam. 

  • Edit the user_prefs file in your .spamassassin directory
  • Add one line for each address. Examples:
    whitelist_from        someone@somewhere.com
    whitelist_from        *@somewhere.com
    whitelist_from        *.somewhere.com
    

 

Blacklists

A blacklist is a list of domain and/or addresses from which email will ALWAYS be tagged as spam.

  • Edit the user_prefs file in your .spamassassin directory
  • Add one line for each address. Examples:
    blacklist_from        someone@somewhere.com
    blacklist_from        *@somewhere.com
    blacklist_from        *.somewhere.com
    

 


If all that doesn't work

An additional step may be required to ensure proper filtering, you may need to define a .forward file in your home directory to ensure that procmail is envoked for every new email.

.forward


"| exec /usr/local/bin/procmail"