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