############################################################### # Here we go.... # # my very own mail-mangler # ################################################################ ################################################################ # In the spirit of the net, 90% of this came from other people # # and the remaining 10% might be from me. Most of the 90% # # came from these sources: # # # # "Getting started with procmail" at # # http://www.hrweb.org/spambouncer/proctut.shtml # # http://www.hrweb.org/spambouncer/procmail.rc # # ...by Catherine A. Hampton. # # # # man procmail (overview) # # man procmailrc (writing the procmailrc) # # man procmailex (example recipes) # # man formail (especially for splitting digests) # # # # and .procmailrcs from several friends. Thanks, folks, # # especially to the one who had more patterns which sent # # things to /dev/null than to mailboxes, for showing me # # what true impatience with email was like! # ################################################################ ################################################################ # Procmailrc files have two parts. First you tell it where # # everything lives. Then you tell it the recipes. # ################################################################ ########################################## # Varibiggles and where everything lives # ########################################## ################################################################ # All of these will work quite happily without changing for # # Red Hat Linux 6.0 and 6.1. They won't necessarily work for # # other flavours without changing paths. See the "Getting # # started with procmail" doc I mentioned above for the likely # # settings for them in other environments. It has a list :) # ################################################################ SHELL=/bin/bash # Have to have this one (or whatever your shell is) # Best bet is bash or sh. LINEBUF=4096 # Magic. Apparently it burps on long lines if you don't # put this in. PATH=/bin:/usr/bin:/usr/local/bin # Where procmail looks for stuff. Works for RH 6.0, 6.1 # and most other Linux settings I've seen. VERBOSE=off # Change to 'on' to get _long_ procmail log. # NB: if this is short, I don't want to see long: I get # a one-line summary for every email procmail looks at! MAILDIR=$HOME/Mail # Not where your mail arrives on the machine. Where # procmail will assume all the folders you mention in # your recipes goes. Make sure your email-reading # program also knows about it. (I understand $HOME/Mail # is pretty standard, however.) LOGFILE=$HOME/procmaillog # I don't think this needs to be in your Mail folder, # but my mail-reader (mutt) is great at different # sorting, so I put the log into the mail directory :) FORMAIL=/usr/bin/formail # 'formail'. Part of the procmail package. Correct # the path if this isn't where it lives for you. # ('which formail' may well tell you.) SENDMAIL=/usr/sbin/sendmail # As with formail, tells procmail where to look for # sendmail. If sendmail isn't there, mail transfer # might be handled by a different program. Ask # your sysadmin :) If you are your own sysadmin, # then I hope you know. # Block the twit Mitch @ Netside's emails :0 * ^From:.*mitch@netside.net /dev/null ############################ # The recipes - I hope... # ############################ ################################################################ # Gods know how this works. But it's very useful. If you get # # email that is sent simultaneously to you and to two other # # lists, this will nuke two of those so that you only see it # # once. Came from 'man procmail'. # ################################################################ # Nuke duplicate messages :0 Wh: msgid.lock | $FORMAIL -D 8192 .cache/msgid.cache ################################################################ # Next two are from the 'Getting started with procmail' doc. # # I'm not too sure about how they work, but they look handy... # ################################################################ # Create a backup cache of 200 most recent messages in case of # mistakes (yes, you can change the 200 to 20 or 400 or whatever # you want) #:0 c #backup # :0 ic # | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,200d` # Regenerate "From" lines to make sure they are valid :0 fhw | formail -I "From " -a "From " :0 BH: * 1^0 ^From: Hahaha * 1^0 ^WkUAAJp94CBoYyiCHKdIkoCQIAQsAagx * 1^0 ^cPBMe5fIi7VY6dQDhmNwVYFN8TufX1b1hYXVk * 1^0 ^lCQoAQAAA0ICPQCAAAB3J4PADIlCAomFAgAAg * 1^0 ^MHMvVnFfzA0iKKlVHXEKultarHMTOIu * 1^0 ^DECogHVOqAF0NYO9dBwAAAh0CseFdBwAAAEAAADGhW4 * 1^0 ^jLEQiU3XXgCAtRSJRelZAIDhQI1FyUwAgOH4hTUwuYt * 1^0 ^SRhHRweQ6vLzFseQzRCL3fNqnKKa5XpRgFdQgOIT * 1^0 ^If you are using another Operative System, please don't wait * 1^0 ^7q1lFnDi5hXsSYzuean5UNILiTpbS7xeP5 * 1^0 ^i0oMiUgMw2aBOgABdBRmgToBAXUnUOjb * 1^0 ^AAC4TWltZegPAAAAuA0KDQroBQAAAOl3AQAAYDk * 1^0 ^0pmCHtLuKw9NDEL34t8pD87MRy5N2bRcT * 1^0 ^Dnnl0545AVb0370FCZfsYllGNnyI9Ml3mOw98F3g * 1^0 ^Z0gSPTNEI2YAPiu7YYJW5q94cmMWly6hsWNpffE virus :0 H: * ^Received.*netaddress\.usa\.net * ^Received.*cibi\.net\.ph * ^Received.*211\.34\.52 * ^Received.*211\.167\.73 * ^From.*em5000 * ^.*netvigator\.com spam :0: * ^From.*amanda@ Amanda :0: * ^Mailing-List.*avlug AVLUG :0: * ^X-list.*bluefish-dev Bluefish :0: * ^Delivered-To.*BUGTRAQ BugTraq :0: * ^Mailing-List.*california-volleyball California-Volleyball :0: * ^X-BeenThere.*clie-linux@ Clie-Linux :0: * ^X-BeenThere.*clug_officers CLUG_Officers :0: * ^X-BeenThere.*cerritoslug CerritosLUG :0: * ^X-Loop.*oclug\.org OCLUG :0: * ^X-BeenThere.*cglug\.org CLUG :0: * ^X-BeenThere.*courier-users Courier :0: * ^List-Post.*demime Demime :0: * ^X-BeenThere.*grip-users Grip :0: * ^List-Help.*horde-help Horde :0: * ^List-Post.*imp@ IMP :0: * ^X-BeenThere.*lausd_mdk LAUSD :0: * ^X-Loop.*lilax LiLAX :0: * ^Sender.*LINUX-390@ Linux-390 :0: * ^X-BeenThere.*linuxplc LinuxPLC :0: * ^X-BeenThere.*Sec@Linux- LSec :0: * ^X-BeenThere.*lula LULA :0: * ^Mailing-List.*lula LULA :0: * ^Sender.*majordomo-users-owner Majordomo :0: * ^X-Loop.*expert Mandrake_Expert :0: * ^list-post.*exploits@mandrakesecure Mandrake_Exploits :0: * ^X-Loop.*newbie Mandrake_Newbie :0: * ^list-post.*discuss@mandrakesecure Mandrake_Security :0: * ^list-post.*snf@mandrakesecure Mandrake_SNF :0: * ^Subject.*orning.*rayer Morning_Prayers :0: * ^Sender.*owner-mutt-users Mutt :0: * ^X-Loop.*nanog Nanog :0: * ^X-Loop.*nanp\@ nanp :0: * ^X-BeenThere.*notdmcala NotDMCALA :0: * ^Sender: owner-nssldap nss_ldap :0: * ^X-Loop.*oclug-devel OCLUG-devel :0: * ^X-Loop.*oclug-recycle OCLUG-recycle :0: * ^Reply-To.*oclug@ OCLUG :0: * ^X-Loop.*OpenLDAP OpenLDAP :0: * ^.*:.*plc@mrball.net PLC :0: * ^Mailing-List.*qmail-help qmail :0: * ^Mailing-List.*qmail-ldap-help Qmail-LDAP :0: * ^Mailing-List.*reiserfs ReiserFS :0: * ^Mailing-List.*route66 Route66 :0: * ^X-BeenThere.*route66lug Route66LUG :0: * ^X-Loop.*roxen Roxen :0: * ^X-Loop.*source Roxen_Modules :0: * ^list-post.*rpmhelp@ rpmhelp :0: * ^X-BeenThere.*sclug@ SCLUG :0: * ^Sender.*own-sgvlug SGVLUG :0: * ^X-BeenThere.*squirrelmail-users SquirrelMail :0: * ^X-BeenThere.*squirrelmail-devel SquirrelMail-devel :0: * ^X-BeenThere.*squirrelmail-list SquirrelMail :0: * ^X-BeenThere.*squirrelmail-plugins SquirrelMail-plugins :0: * ^X-BeenThere.*svlug SVLUG :0: * ^Sender.*owner-forum@t13 T13 :0: * ^X-BeenThere.*twin-develop Twin :0: * ^X-BeenThere.*ucla.edu UCLA :0: * ^X-BeenThere.*usclug-chat USCLUG :0: * ^Sender.*owner-UUASC UUASC :0: * ^X-BeenThere.*warp2 Warp2 :0: * ^X-To-Get-Off-This-List.*wxftp.seul.org WXFTP :0: Inbox