5247d2
################################################################
5247d2
#                  Here we go....                              #
5247d2
#                  my very own mail-mangler                    #
5247d2
################################################################
5247d2
5247d2
################################################################
5247d2
# Updated to have working URLs and arbitrarily version-bumped  #
5247d2
# to 1.2 on the grounds it matched the mutt version. Very      #
5247d2
# little beyond URLs and list addresses has changed.           #
5247d2
#                                 2002-03-21.                  #
5247d2
################################################################
5247d2
5247d2
5247d2
################################################################
5247d2
# In the spirit of the net, 90% of this came from other people #
5247d2
# and the remaining 10% might be from me. Most of the 90%      #
5247d2
# came from these sources:                                     #
5247d2
#                                                              #
5247d2
#	"Getting started with procmail" at                     #
5247d2
#                http://www.spambouncer.org/proctut.shtml      #
5247d2
#                http://www.spambouncer.org/procmail.rc        #
5247d2
#	...by Catherine A. Hampton.                            #
5247d2
#                                                              #
5247d2
#	man procmail (overview)                                #
5247d2
#	man procmailrc (writing the procmailrc)                #
5247d2
#       man procmailex (example recipes)                       #
5247d2
#       man formail (especially for splitting digests)         #
5247d2
#                                                              #
5247d2
#	and .procmailrcs from several friends. Thanks, folks,  #
5247d2
#       especially to the one who had more patterns which sent #
5247d2
#       things to /dev/null than to mailboxes, for showing me  #
5247d2
#       what true impatience with email was like!              #
5247d2
################################################################
5247d2
                                                                
5247d2
################################################################
5247d2
# Procmailrc files have two parts. First you tell it where     #
5247d2
# everything lives. Then you tell it the recipes.              #
5247d2
################################################################
5247d2
5247d2
##########################################
5247d2
# Varibiggles and where everything lives #
5247d2
##########################################
5247d2
5247d2
################################################################
5247d2
# All of these will work quite happily without changing for    #
5247d2
# Red Hat Linux 6.0 through to 7.2.They won't necessarily work #
5247d2
# for other flavours without changing paths. See the "Getting  #
5247d2
# started with procmail" doc I mentioned above for the likely  #
5247d2
# settings for them in other environments. It has a list :)    #
5247d2
################################################################
5247d2
5247d2
################################################################
5247d2
# Since I installed procmail, I have changed from using        #
5247d2
# sendmail to using exim. Because I can understand the config  #
5247d2
# file. If you use exim, you may need to tweak the config file #
5247d2
# as I did. If you do, then check you are reading the docs for #
5247d2
# the right version of exim! This worked for me:               #
5247d2
#                                                              #
5247d2
# http://www.exim.org/exim-html-3.20/doc/html/spec_18.html     #
5247d2
# and look for procmail. It's in the example for the 'pipe     #
5247d2
# transport'. Just paste it into /etc/exim.conf.               #
5247d2
################################################################
5247d2
5247d2
SHELL=/bin/bash		
5247d2
	# Have to have this one (or whatever your shell is)
5247d2
	# Best bet is bash or sh. 
5247d2
5247d2
LINEBUF=4096            
5247d2
	# Magic. Apparently it burps on long lines if you don't
5247d2
        # put this in.
5247d2
5247d2
PATH=/bin:/usr/bin:/usr/local/bin
5247d2
	# Where procmail looks for stuff. Works for RH 6.0, 6.1
5247d2
	# and most other Linux settings I've seen. 
5247d2
5247d2
VERBOSE=off
5247d2
        # Change to 'on' to get _long_ procmail log. 
5247d2
        # NB: if this is short, I don't want to see long: I get
5247d2
	# a one-line summary for every email procmail looks at!
5247d2
5247d2
MAILDIR=$HOME/Mail	
5247d2
	# Not where your mail arrives on the machine. Where
5247d2
	# procmail will assume all the folders you mention in
5247d2
	# your recipes goes. Make sure your email-reading
5247d2
	# program also knows about it. (I understand $HOME/Mail
5247d2
	# is pretty standard, however.)
5247d2
5247d2
LOGFILE=$HOME/Mail/procmaillog
5247d2
	# I don't think this needs to be in your Mail folder,
5247d2
	# but my mail-reader (mutt) is great at different 
5247d2
	# sorting, so I put the log into the mail directory :)
5247d2
	# Note learned through experience: if you leave this file
5247d2
	# too long, it will end up with tens of thousands of
5247d2
	# messages. Mutt is not always -that- good at sorting
5247d2
	# that lot quickly :)
5247d2
5247d2
FORMAIL=/usr/bin/formail
5247d2
	# 'formail'. Part of the procmail package. Correct
5247d2
	# the path if this isn't where it lives for you.
5247d2
	# ('which formail' may well tell you.)
5247d2
5247d2
SENDMAIL=/usr/sbin/sendmail 
5247d2
	# As with formail, tells procmail where to look for
5247d2
	# sendmail. If sendmail isn't there, mail transfer
5247d2
	# might be handled by a different program. Ask
5247d2
	# your sysadmin :) If you are your own sysadmin,
5247d2
        # then I hope you know. 
5247d2
	# Subsequent to writing that, I have learned that this
5247d2
	# file is provided (with this name) by other MTAs too.
5247d2
	# I now use Exim (see note above) and this file is still
5247d2
	# there, courtesy of exim.
5247d2
5247d2
5247d2
############################
5247d2
# The recipes - I hope...  #
5247d2
############################
5247d2
5247d2
################################################################                                                                
5247d2
# Gods know how this works. But it's very useful. If you get   #
5247d2
# email that is sent simultaneously to you and to two other    #
5247d2
# lists, this will nuke two of those so that you only see it   #
5247d2
# once. Came from 'man procmail'.                              #
5247d2
################################################################
5247d2
5247d2
# Nuke duplicate messages
5247d2
:0 Wh: msgid.lock
5247d2
| $FORMAIL -D 8192 msgid.cache
5247d2
5247d2
################################################################
5247d2
# Next two are from the 'Getting started with procmail' doc.   #
5247d2
# I'm not too sure about how they work, but they look handy... #
5247d2
################################################################
5247d2
5247d2
# Create a backup cache of 200 most recent messages in case of 
5247d2
# mistakes (yes, you can change the 200 to 20 or 400 or whatever
5247d2
# you want)
5247d2
:0 c
5247d2
backup
5247d2
5247d2
  :0 ic
5247d2
  | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,200d`
5247d2
5247d2
# Regenerate "From" lines to make sure they are valid
5247d2
:0 fhw
5247d2
| formail -I "From " -a "From "
5247d2
5247d2
5247d2
################################################################
5247d2
# For testing shit - I picked a subject line that no-one would #
5247d2
# send me and then tried different recipes on the results, and #
5247d2
# then sent myself a whole pile of email about grobblefruit,   #
5247d2
# with different recipes here, to see what happened when I     #
5247d2
# tried different headers and so on.                           #
5247d2
################################################################
5247d2
5247d2
:0:
5247d2
* ^Subject: Test grobblefruit
5247d2
IN.testing
5247d2
5247d2
5247d2
################################################################
5247d2
#                       Mailing lists                          #
5247d2
#                                                              #
5247d2
# I think this is the thing that most people who finally get   #
5247d2
# procmail want to know about: how to get different messages   #
5247d2
# from different mailing lists into different folders. This is #
5247d2
# where all that MAILDIR stuff comes from. All the folders I   #
5247d2
# name in here are all created off whatever directory I filled #
5247d2
# in as the MAILDIR at the start. And no, they don't suddenly  #
5247d2
# appear the instant you edit this file. They only appear when #
5247d2
# procmail finds mail that should go in them.                  #
5247d2
#                                                              #
5247d2
# You can have more than one recipe sending email into the     #
5247d2
# same folder, btw, yes.                                       #
5247d2
#                                                              #
5247d2
# General useful (?) comments:                                 #
5247d2
#	The "^Resent-From: " pattern works wonderfully on      #
5247d2
#    lists which generate it.                                  #
5247d2
#	Making the folder not -quite- the list name means you  #
5247d2
#    can save mail from it to a folder named for the list. Can #
5247d2
#    be handy.                                                 #
5247d2
#	Some lists are indeed a pig to catch everything with.  #
5247d2
#	"TO" is different from "To" and you mustn't put a      #
5247d2
#    a space after "TO". It catches "To: " and "Cc: ", I       #
5247d2
#    think. Very handy. But it doesn't catch everything. If    #
5247d2
#    it's a mailman list, don't use it and see below.          #
5247d2
#	Mailman-run lists all seem to have a Sender: header    #
5247d2
#    which is very useful to sort with. Just add -admin onto   #
5247d2
#    the name of the mailing list.                             #
5247d2
#	Even more useful for mailman-run lists turns out to be #
5247d2
#    "X-BeenThere: listname@site.com"                          #
5247d2
################################################################
5247d2
5247d2
################################################################
5247d2
# I hardly use TO now, but here's an example in case.          #
5247d2
################################################################
5247d2
5247d2
:0:
5247d2
* ^TOlynx-dev@sig.net
5247d2
IN.lynx-dev
5247d2
5247d2
###########
5247d2
# bugtraq #
5247d2
###########
5247d2
5247d2
:0:
5247d2
* ^Sender:.*Bugtraq List
5247d2
IN.bugtraq
5247d2
5247d2
#########################
5247d2
# gnome CVS commit list #
5247d2
#########################
5247d2
5247d2
:0:
5247d2
* X-BeenThere: cvs-commits-list@gnome.org
5247d2
IN.cvs-commits
5247d2
5247d2
5247d2
##############
5247d2
# gnome-list #
5247d2
##############
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: gnome-list@gnome.org
5247d2
IN.gnome-list
5247d2
5247d2
5247d2
##################
5247d2
# gnome-doc-list #
5247d2
##################
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: gnome-doc-list@gnome.org
5247d2
IN.gnome-doc-list
5247d2
5247d2
5247d2
###############################################################
5247d2
# linuxchix lists: there are several mailing lists here: see  #
5247d2
# the end of this file for the different ways to deal with    #
5247d2
# heavy traffic lists with digest options.                    #
5247d2
###############################################################
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: grrltalk@linuxchix.org
5247d2
IN.linuxchix
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: issues@linuxchix.org
5247d2
IN.linuxchix
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: techtalk@linuxchix.org
5247d2
IN.linuxchix
5247d2
5247d2
5247d2
#################################################
5247d2
# This is what I consider advanced stuff: this  #
5247d2
# one doesn't put the digest straight into a    #
5247d2
# folder. Instead it runs 'formail +1 -ds',     #
5247d2
# which splits the digest into its original     #
5247d2
# messages, and then puts the results of that   #
5247d2
# into the folder.                              #
5247d2
#                                               #
5247d2
# The address is way way out of date, but I am  #
5247d2
# not sure of the current digest address, so I  #
5247d2
# have left it.                                 #
5247d2
#                                               #
5247d2
# It is commented out because I actually read   #
5247d2
# the main list, not the digest, these days.    #
5247d2
#################################################
5247d2
5247d2
# :0: 
5247d2
# * ^TOgrrltalk-digest@hub.org
5247d2
# | formail +1 -ds >> IN.linuxchix
5247d2
5247d2
5247d2
##############
5247d2
# mutt-users #
5247d2
##############
5247d2
:0:
5247d2
* ^TOmutt-users@mutt.org
5247d2
IN.mutt-users
5247d2
5247d2
:0:
5247d2
* ^Sender: owner-mutt-users@mutt.org
5247d2
IN.mutt-users
5247d2
5247d2
5247d2
#################################################
5247d2
# Procmail list                                 #
5247d2
#	...be aware that everyone on this list	#
5247d2
# seems to have monster spam filters and thus   #
5247d2
# to be completely unconcerned at the huge      #
5247d2
# amount of spam it gets: you will either need  #
5247d2
# spam filters or tolerance to find the good    #
5247d2
# stuff. (I am not subscribed now, but that was #
5247d2
# the case when I was.)                         #
5247d2
#################################################
5247d2
5247d2
:0:
5247d2
* ^TOprocmail@Informatik.RWTH-Aachen.DE
5247d2
IN.procmaillist
5247d2
5247d2
5247d2
#######################################################
5247d2
# Red Hat announce -- very handy for security updates #
5247d2
#######################################################
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: redhat-announce-list@redhat.com
5247d2
IN.rh-announce
5247d2
5247d2
:0:
5247d2
* ^X-BeenThere: redhat-watch-list@redhat.com
5247d2
IN.rh-announce
5247d2
5247d2
5247d2
#########################
5247d2
# windowmaker: wm-users #
5247d2
#########################
5247d2
5247d2
:0:
5247d2
*^From wm-user-request@windowmaker.org
5247d2
IN.wm-user
5247d2
5247d2
################################################################
5247d2
#                 Splitting digests                            #
5247d2
#                                                              #
5247d2
# You don't need to do this, but this seems to be another very #
5247d2
# popular thing to do with procmail. If you're on mailing      #
5247d2
# lists using the digest option, sometimes you may want to     #
5247d2
# split the digests back up into the original emails. There is #
5247d2
# (of course) more than one way to do this:                    #
5247d2
#                                                              #
5247d2
# (1) don't bother: just read through all the digest in one    #
5247d2
# big lump. Simple, easy, and great until you find someone     #
5247d2
# sent a 500-line postscript file or a giant jpg which got     #
5247d2
# included into the digest :(                                  #
5247d2
#                                                              #
5247d2
# (2) use a mail-reader such as mutt, and if you suddenly want #
5247d2
# to split a digest up, then whilst reading the message, hit   #
5247d2
# 	| formail +1 -ds                                       #
5247d2
# which will put the results into your main inbox. If you want #
5247d2
# it in a particular folder (like the one you're reading), do  #
5247d2
#	| formail +1 -ds >> foldername                         #
5247d2
#                                                              #
5247d2
# (3) make procmail (or formail, actually), split it up ready  #
5247d2
# for you to read.                                             #
5247d2
#                                                              #
5247d2
# So if you want to have each digest automatically split up    #
5247d2
# by procmail as it arrives, and to read each message          #
5247d2
# individually, then here's some examples of what you can put. #
5247d2
# The first two lines are exactly the same. The third one has  #
5247d2
# a pipe (vertical line) symbol at the start, and then the     #
5247d2
# command you're piping it through.                            #
5247d2
#                                                              #
5247d2
# Yes, I picked a notoriously heavy-traffic one for the first  #
5247d2
# example... And it -should- work, but it's not a list I read, #
5247d2
# sorry!                                                       #
5247d2
#                                                              #
5247d2
# Instead of this:                                             #
5247d2
#	:0:                                                    #
5247d2
#	* ^Sender: owner-linux-kernel@vger.rutgers.edu         #
5247d2
#	IN.linux-kernel                                        #
5247d2
# ...you want this:                                            #
5247d2
#	:0:                                                    #
5247d2
#	* ^Sender: owner-linux-kernel@vger.rutgers.edu         #
5247d2
#	| formail +1 -ds >> IN.linux-kernel                    #
5247d2
#                                                              #
5247d2
# Da-dah! That's all.                                          #
5247d2
#                                                              #
5247d2
# And for those where the list name changes and that's what    #
5247d2
# you're matching patterns on, instead of this:                #
5247d2
# 	:0:                                                    #
5247d2
# 	* ^TOgrrltalk@hub.org                                  #
5247d2
# 	IN.linuxchix                                           #
5247d2
# ...you want this:                                            #
5247d2
#	:0:                                                    #
5247d2
* 	^TOgrrltalk-digest@hub.org                             #
5247d2
#	| formail +1 -ds >> IN.linuxchix                       #
5247d2
#                                                              #
5247d2
# Magic :)                                                     #
5247d2
################################################################
5247d2
5247d2
5247d2
5247d2
################################################################
5247d2
# That's it. Any email that doesn't match any of the recipes   #
5247d2
# above goes into my usual place for email, which until I read #
5247d2
# it is /var/spool/mail/hobbit. Procmail appears to know about #
5247d2
# that without being told.                                     #
5247d2
#                                                              #
5247d2
# Quick summary for adding your own or changing these: the     #
5247d2
# general format for putting an email into a folder and not    #
5247d2
# doing anything fancy to it first is:                         #
5247d2
#                                                              #
5247d2
# :0:                                                          #
5247d2
# * <what you're looking for>                                  #
5247d2
# <where you're putting it>                                    #
5247d2
#                                                              #
5247d2
# The ^ sign in my recipes is the sign procmail understands as #
5247d2
# "start of the line", so "^From" matches the word "From" when #
5247d2
# it's the start of a header.                                  #
5247d2
#                                                              #
5247d2
# The "IN." at the start of folder names is not necessary:     #
5247d2
# that's just my naming system. Stolen, like everything else,  #
5247d2
# from a friend's example. It has the benefit that with my     #
5247d2
# mail-reader (mutt), which sorts alphabetically, all of them  #
5247d2
# show up first (capitals are earlier in the alphabet if       #
5247d2
# you're a computer...) and I can save them easily: from       #
5247d2
# IN.blah to blah. If you want to call the folders blah-spool, #
5247d2
# or just blah, then cool. That'll work, too.                  #
5247d2
#                                                              #
5247d2
# It is possible that now you have everything in different     #
5247d2
# folders, you want to read with a cool program which does     #
5247d2
# cool things like display by thread or which understands you  #
5247d2
# when you tell it "These are mailing lists" and does handy    #
5247d2
# things as a result. If you do, and you discover Mutt, you    #
5247d2
# might want to look at my muttrc which is probably next to    #
5247d2
# this file.                                                   #
5247d2
#                                                              #
5247d2
# Have fun!                                                    #
5247d2
#                             -- Telsa                         #
5247d2
################################################################