procmail config help

Karl Vogel vogelke+unix at
Wed Nov 17 22:14:10 UTC 2010

>> On Wed, 17 Nov 2010 19:59:10 +0000 (UTC), 
>> AN <andy at> said:

A> If anyone has a working procmail config file to share that would be
A> appreciated.

   When messing with procmail, start with the simplest setup that can
   possibly work.  Your logfile has to exist, or procmail will ignore it.
   If you already have a working .procmailrc file, here's a safe way to
   add tweaks:

   1. copy an existing mail message to /tmp/msg,
   2. cp $HOME/.procmailrc $HOME/.procnew and DON'T touch the original,
   3. run "procmail -m $HOME/.procnew < /tmp/msg" to test.

   Try the .procmailrc skeleton below.  The .whitelist and .blacklist files
   hold email addresses (one per line) that you want to pass or block,
   respectively.  Logfiles are stored in the user's ~/mail directory.

Karl Vogel                      I don't speak for the USAF or my company

Why you might be the reincarnation of someone famous #11:
When your boss criticizes your sales projection figures, you hack off your ear.
                                        --The Top Five List, top5 at

# $Revision: 1.60+6 $ $Date: 2010-07-08 15:19:01-04 $
#    $HOME/.procmailrc
#    "procmail" handles local mail delivery.  Use this file to:
#    - store your mail in a given folder,
#    - forward or discard mail depending on the contents, or
#    - run your mail through a program automatically.

# Search path.

# Default mail folder.

# Current directory while procmail is executing.
# All pathnames are relative to this directory.

# File containing error messages or diagnostics.  If this
# file does not exist, said messages will be bounced
# back to the message sender.

# If yes, keep an abstract of the From and Subject lines of
# each delivered message, the folder it was delivered to,
# and the size of the message.  If no, skip this abstract.

# If on, describe actions of procmail in detail.

# Number of seconds before procmail zaps a lockfile by force.

# Default shell and umask value.

# Frequently-used variables.
WEEK="`/bin/date +%Yw%W`"

# Rules section.
# RULE: Save a copy of all incoming headers in a file called
#               $HOME/mail/HEADERS.YYYYwNN
#       where YYYY = year
#       NN = the week number starting on Monday.

:0 chw: $HOME/hdr.lck
| /bin/cat - >> $HOME/mail/HEADERS.$WEEK;

# RULE: pass anything in the sender whitelist.

* ? formail -x"From:" -x"From" -x"To:" -x"Reply-To:" -x"Cc:" \
     | fgrep -is -f $HOME/.whitelist

# RULE: kill anything in the sender blacklist.

* ? formail -x"From:" -x"From" -x"To:" -x"Reply-To:" -x"Cc:" \
     | fgrep -is -f $HOME/.blacklist

# Keep everything else.

:0 :

More information about the freebsd-questions mailing list