Example for a .procmailrc File

Last Update 1999-11-24
If you are a user at the Institute of Computer Science and Applied Mathematics, have a look at the FAQ first, to see how to use procmail. This is an example of a .procmailrc file. You have to change it to suit your needs. There are many initiatives against spam on the internet .
MAILDIR=$HOME/Mail      #you'd better make sure it exists
COMSAT=no
LOGFILE=$MAILDIR/procmail.log
SPAM=$MAILDIR/spam
UNWANTED=$MAILDIR/unwanted
TRASH=/dev/null
# error codes used by sendmail
EX_NOUSER=67
EX_UNAVAILABLE=69
EX_NOPERM=77
# -------------------------
# spammer
:0
* ^From.*\<(bulkemail@espmail\.net|mandy\.com|savetrees\.com)\>
{ 
	EXITCODE = $EX_NOUSER
	:0 i
	$TRASH
} 
# -------------------------
# Cyberpromo
:0
* (Received: .*CLOAKED|cyberpromo\.com)
{ 
	EXITCODE = $EX_NOPERM
	:0 i
	$TRASH
} 
# -------------------------
# unwanted subjects
:0 D
* ^Subject.*(READ THIS)
{ 
	EXITCODE = $EX_UNAVAILABLE
	:0 i
	$SPAM
} 
# -------------------------
# bad mailer
:0 D
* ^X-[Mm]ailer:.*(MassE-Mail|Floodgate|Extractor|FastMail|WorldMerge)
{ 
	EXITCODE = $EX_NOUSER
	:0 i
	$SPAM
} 
# -------------------------
# bad message-id
:0
* ^Message-Id: <>$
{ 
	EXITCODE = $EX_NOUSER
	:0 i
	$UNWANTED
} 
# -------------------------
# replace USER with your name
:0
* ^TOFriend@public\.com
* !From:.*\<USER\>
{ 
	EXITCODE = $EX_UNAVAILABLE
	:0 i
	$UNWANTED
}

You can also add something like this (if you are a local user at our Institute , otherwise replace informatik.uni-kiel.de with your domain):
# not directly to me? (USER@informatik.uni-kiel.de)
:0:
* !^(To|Cc):.*informatik.uni-kiel.de
* !^(To|Cc):.*\<(USER)\>
$UNWANTED
but make sure you are not on some mailing lists or you filter these first, e.g.,
:0:
* ^TOhaskell
haskell

[(links)] [Hints] [Avoiding UBE] [cf/README] [New]
Copyright © Claus Aßmann Please send comments to: <ca at sendmail.org>
Disclaimer: the information provided may be inaccurate or outdated or incomplete. Please contact me if you find an error.