# Generic procmailrc v1.1 2004-09-22 pteron # see http://pteron.net/code for updates # Uncomment the following lines and use tail -f procmail.log to debug #UMASK=027 #LOGDATE=`date "+%Y.%m.%d"` #LOGFILE=$HOME/logs/procmail_log_$LOGDATE #VERBOSE=yes #LOGABSTRACT=all #UMASK=077 SHELL=/bin/sh # set the default to catch anything that falls through the recipes DEFAULT=$HOME/Maildir/ # cd to the Maildir directory MAILDIR=$DEFAULT # no point in biffing COMSAT=no # point directly at the executables, speeds things up a tad SPAMASSASSIN=/usr/local/bin/spamassassin SALEARN=/usr/local/bin/sa-learn SED=/usr/bin/sed TEST=/bin/test EGREP=/usr/bin/egrep FORMAIL=/usr/local/bin/formail TMDAFILTER=/usr/local/bin/tmda-filter # Correct wrong sig-dashes, ie add a space for lines with only "--" in them: # to activate, create folder "correct-sig-dashes" in folder CONTROL/active # from: ^--$ # to: ^-- $ :0 fBw * ? $TEST -d .CONTROL.active.correct-sig-dashes * ^--$ | $SED -e 's/^--$/-- /' # check whitelist, don't run spam checking on addresses contained in it :0 * 1^0 !? $TEST -d .control.procmail.whitelist * 1^0 !? $FORMAIL -rtzxTo: | $EGREP -is -f $HOME/.mail/whitelist { # If user has created a SPAM folder, then send all mail through SpamAssassin :0 * ? $TEST -d .SPAM { # Feed redirected spam to sa-learn, and also store a copy in a folder called spam. # This folder of false negatives could be useful if we needed to rebuild our Bayes # database in the future. :0 * ^To:.*spam * < 256000 { :0c: spamassassin.spamlock | $SALEARN --spam :0 .SPAM/ } :0fw: spamassassin.lock * < 256000 | $SPAMASSASSIN # If the mail is likely spam and the user has created a PROBABLY-SPAM folder # save it on the server for checking at leisure, to drop it (NOT recommended unless # your spamassassin threshold is high, say 15 or more), uncomment the dev/null line # and comment the .PROBABLY-SPAM line. If no PROBABLY-SPAM folder exists then mail drops # through to INBOX but with the spamassassin headers added. :0 * ^X-Spam-Flag: YES * ? $TEST -d .PROBABLY-SPAM #/dev/null .PROBABLY-SPAM/ } } # if the lists directory exists then try to automatically process # mailing lists. In each case, if the relevent list box does not # exist then allow mail to drop through to next recipe :0 * ? $TEST -d .lists { # Automagically handle nice standards conformant mailing lists - this # rule and the majordomo recipe appear courtesy of Jeff Waugh Records :0 * ^(List-Id|(X-)?Mailing-List|X-List):\/.* { LISTID=$MATCH :0 * LISTID ?? ^.*(contact)?.*[<]\/[^@>\.]* * ? $TEST -d ".lists.$MATCH" ".lists.$MATCH"/ LISTNAME=$MATCH :0 E * LISTID ?? ^.*(contact)? \/[^@\.]* * ? $TEST -d ".lists.$MATCH" ".lists.$MATCH"/ LISTNAME=$MATCH } # onelist/egroups/yahoogroups/whatever_they're_called_today # lists with their non-standard header format, and ad nuker # courtesy of http://spacepants.org/conf/dot.procmailrc :0 * ^Mailing-List: list \/[^@]+ { oldshellmetas="$SHELLMETAS" SHELLMETAS="" LISTID=$MATCH :0 fbw * ? $TEST -d ".control.procmail.zapyahootextads" | $SED -e '/-\~--> $/,/--\~-> $/d' SHELLMETAS="$oldshellmetas" :0 * ? $TEST -d ".lists.$LISTID" ".lists.$LISTID"/ LISTNAME=$LISTID } # majordomo lists - comes after the CSE list recipe because of erroneous # filtering; some Sender: headers made by CSE lists match on this recipe :0 * ^Sender: owner-[^@]+@[^@]+ * ^Sender: owner-\/[^@]+ * ? $TEST -d ".lists.$MATCH" ".lists.$MATCH"/ LISTNAME=$MATCH } # If the control directory tmda is created then run mail through tmda # first try to pass mailing lists as the amount of hate mail can be considerable! :0 * ? $TEST -d .control.tmda * !^(List-Id|(X-)?Mailing-List|X-List|Sender: owner) { # NB this depends upon the RECIPIENT_HEADER in the tmda # config file being set to "X-Original-To" # We filter through TMDA and use the return value to # either drop the message or pass it through for # further procmail processing. :0 fW | $TMDAFILTER -p EXITCODE = $? :0 * EXITCODE ?? 99 { EXITCODE = 0 :0 .Trash/ #/dev/null } } # everything left drops into inbox