Procmail

Here’s a sample of my old procmail configuration file.  I used to do a lot of server side filtering with my email.  The below shows a few examples of matches based on subjects, senders, destinations, as well as some more complex matching of header items.  There’s no support with this file, it is to be used as reference only.

MAILDIR=/home/dclarke/Maildir/
SPAMDIR=$MAILDIR.Spam/
MONTH=`date +%Y-%m`#:0fw

#| spamc# hammer out the spammers
:0:
*^X-Spam-Flag: YES.*
$SPAMDIR

#:0:
#*^Subject: Re: [A-Z],.*
#$SPAMDIR

:0:
*^From:.*service@paypal.com.*
$MAILDIR.x-PayPal/

:0:
*^Subject:.*Word of the Day.*
$MAILDIR.list-WotD/

:0:
*^From: .*eurorscg.com
$MAILDIR.#Euro/

:0:
*^Subject: OpenSRS Live Reseller Update.*
$MAILDIR.list-opensrs-updates/

:0:
*^Subject:.*failure notice.*
$MAILDIR.x-failures.$MONTH/

:0:
*^Subject:.*New VHost.*
$MAILDIR.x-vhosts/

:0:
*^Subject: Cron.*
$MAILDIR.x-cron/

:0:
*^Subject: VIRUS.*
$MAILDIR.x-virus/

# MOST LISTS - Automagically handle lists
:0
* ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>]*))
{
   LISTID=$MATCH
   :0:
   * LISTID ?? ^\/[^@\.]*
   $MAILDIR.list-$MATCH.$MONTH/
}

# MAJORDOMO - Automagically handle Majordomo lists:0
* ^Sender: owner-[^@]+@[^@\+]+
* ^Sender: owner-\/[^@\+]+
{
   :0:
   $MAILDIR.list-$MATCH.$MONTH/
}

# OpenSRS updates to be Forwarded
:0c:
*^From: replies@opensrs.org
*^Subject: OpenSRS Live Reseller.*
!info@FlatlineSystems.net

:0:
*^From:(.*tbothwel.*|.*sting.*|.*D. Clarke.*)
$MAILDIR.@FLS-Internal/

# default
:0:
$MAILDIR