Additional Information

Intro

This document will lay out how the actual system works and give you some examples of more advanced blocking. First, let's take a look at the flow of email.

Typically, when someone sends you an email message, it travels like this:

Procmail basically acts as another link in the chain:

There are several ways to filter mail through procmail, although the syntax is not pretty. So instead of writing out lengthy procmail rules to filter spam, I wrote a Perl program to take care of that for procmail:

The spamfilter will return a 0 or 1 to procmail indicating whether or not to let the mail pass. It's pretty simple, really. The hardest part is setting it up.


The spamfilter

The spamfilter is a relatively simple program. Much of the code was grabbed from snippets on the web, taken apart and put back together again to provide an easy way to dynamically block email.

The most basic rule of the filter is this:

This is a last resort rule meaning that once all of the other block and pass rules have been exhausted, it ultimately considers the mail spam and returns a 1 to procmail. Block and pass rules are configured in the block.conf file.


block.conf

When procmail passes the email message to the filter, all of the fields are broken down into a hash. The block.conf file provides a means to block/pass email based on those particular fields.

The syntax of block.conf is simple:

Important: the order of your block.conf determines which email messages are block and which are passed. So, if you have a block.conf like this:

...and someone from here.com attempts to send you an email directly, you will not receive it; It will be blocked by the spam filter.

However, if your rule reads like this:

...you will receive any email messages from here.com that are addressed directly to you. Those that are not addressed to you will be blocked.

Additionally, there are a couple of rules built into the block.conf for default spam handling: