##### #### ### Jamie Wilkinson's .procmailrc ## # # based on Tom Gilbert's .procmailrc # # and lots of tips from the SLUGgers # #### ### ## Set up some variables # PATH=/bin:/usr/bin SHELL=/bin/bash MAILDIR=$HOME/Maildir DEFAULT=$MAILDIR/ SED=/bin/sed LOGFILE=$MAILDIR/.procmail.log # VERBOSE=on for more debugging info than you can poke a stick at VERBOSE=off # Spam SPAM=$MAILDIR/.spambox/ SPAMMERS=$HOME/.spammers PLONK=$HOME/.plonk #### ### ## Remove duplicates # # commented out because I like crossposts to get delivered, and I can't # guarantee that the list mail will arrive before any mail addressed to # myself arrives. The best way to fix this is to set your Reply-To: in # your mailer (which is trivial in mutt) to the list address, and trust # that your replies come from unbroken clients who respect this header. #:0 Whc: .msgid.lock #| formail -D 1024000 .msgid.cache # #:0 a: #$HOME/Maildir/.duplicates/ ## # *plonk* :0 * ? (formail -x From: -x Sender: -x Reply-To: -x Received: | fgrep -iqf $PLONK) /dev/null #### ### ## DELETE SPAM FAST!!! # # if it's already got a spam: yes header from my upstream, then bye bye :0: * ^X-Spam-Status: Yes $SPAM # spamassassin is dog slow when doing bayesian analysis, so let's use # bogofilter instead # -u for update wordlists (autolearn based on classification) # -e for embedded operation # -p for pass-through :0fw | bogofilter -e -p # put back in the queue if bogofilter fails :0e { EXITCODE=75 HOST } # put the spam away :0: * ^X-Bogosity: (Spam|Yes), tests=bogofilter $SPAM # MAILMAN REMINDERS # to quote young Jeffrey: # "I'm so completely not interested in receiving these at # the end of every month" :0: * ^From: .*mailman-owner@ * ^Subject: .* mailing list memberships reminder /dev/null #### #### ## Correct crap or broken mails before they're delivered # # Convert old-style PGP messages to MIME :0 * !^Content-Type: multipart/ * !^Content-Type: application/pgp { :0 fBw * ^-----BEGIN PGP MESSAGE----- * ^-----END PGP MESSAGE----- | formail -i "Content-Type: application/pgp; format=text; x-action=encrypt" :0 fBw * ^-----BEGIN PGP SIGNED MESSAGE----- * ^-----BEGIN PGP SIGNATURE----- * ^-----END PGP SIGNATURE----- | formail -i "Content-Type: application/pgp; format=text; x-action=sign" } # sig delimiter fixer thanks to Jeff Waugh again :0 fBw * ^--$ | $SED -e 's/^--$/-- /' :0 fBw * ^_______________________________________________$ | $SED -e 's/^_______________________________________________$/-- /' #### ### ## Pre-sort filters # # now that we've gotten rid of spam, we can fill the lbdb with all the # incoming mail addresses #:0hc #| lbdb-fetchaddr # Add a Content-Length to mails that don't have them :0 hfw * !^Content-Length: | formail -a "Content-Length: 0000000000" #### ### ## Mailing list filtering # # I want to rename these lists :0 * ^List-Id:.*activities.slug.org.au .list.slug-activities/ :0 * ^List-Id:.*committee.slug.org.au .list.slug-committee/ :0 * ^TO_comittee-owner@slug\.org\.au .list.slug-committee/ :0 * ^List-Id:.*admin.slug.org.au .list.slug-admin/ :0 * ^List-Id:.*cvs-annodex.lists.annodex.net .list.libannodex-cvs/ # esoteric languages :0 * ^Sender: lang-bounce@esoteric.sange.fi * ^X-listar-version: .list.esolang/ :0 * ^From:.*noreply@adc.apple.com * ^Reply-To:.*noreply@adc.apple.com .apple-adc/ # generic ezmlm filter, comes before mailman otherwise mailman's filter # will put everything into .list.contact/ :0 * ^Mailing-list: contact .*; run by ezmlm * ^List-Post: [<]mailto:\/.* { LISTID=$MATCH :0 * LISTID ?? ^ *\/[^@]* { LIST=$MATCH :0 * LISTID ?? ^.*@\/[^>\.]* .list.$MATCH-$LIST/ } } # onelist/egroups/yahoogroups/whatever_they're_called_today # lists with their non-standard header format, and ad nuker :0 * ^Mailing-List: list \/[^@]+ { LISTID=$MATCH :0 fbw | sed '/-\~-->$/,/--\~->$/d' :0 .list.$LISTID/ } # 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 ?? ^.*[<]\/[^@>\.]* .list.$MATCH/ :0 * LISTID ?? ^\/[^@\.]* .list.$MATCH/ } # majordomo lists :0 * ^Sender: owner-[^@]+@[^@]+ * ^Sender: owner-\/[^@]+ .list.$MATCH/ # geeks :0 * ^Sender:.*geeks-owner@vergenet\.net * ^Errors-To:.*geeks-owner@vergenet\.net * ^Return-Path:.*geeks-owner@vergenet\.net .list.geeks/ #### ### ## Non-list mailboxes. # # Debian bug report acknowledgements/upload announcements :0 * ^From:.*(@bugs.debian.org|installer@ftp-master.debian.org) .debian/ # bug reports from submit@b.d.o :0 * ^TO_bugs.debian.org .debian/ # Ubuntu bugs :0 * ^From: bugzilla-daemon@bugzilla\.((no-name-yet|ubuntu)\.com|ubuntulinux\.org) .ubuntu/ # gtkradiant bugs :0 * ^From: bugzilla-daemon@zerowing\.idsoftware\.com .gtkradiant/ # quakeforge bugs :0 * ^From: bugzilla-daemon@quakeforge\.net .quakeforge/ # gnome bugs :0 * ^From: bugzilla-daemon@bugzilla\.gnome\.org .gnome/ ## ## orkut ## :0 * ^From:.*member@orkut.com * ^X-Mailer:.*aspNetEmail * ^Subject: orkut .orkut/ ## in the swamp! :0 * ^From:.*swansmembership@sydneyswans.com.au .swans/ #### ### ## Personal mail # # anything that has more than one Fwd in the subject bar is unlikely to # be any good, so filter it away :0 * Subject:.*(f(w:|wd|orward)).*(f(w:|wd|orward)) .forwards/ # somebody loves me :0 $DEFAULT