# *************************************************************** # # See http://ii.best.vwh.net/internet/robots/procmail/qs/#dissect # # The following describes my original approach. It is workable, # but I found I was sending too much garbage to ruth, so I # changed the approach to send ruth only those things that I # specifically knew were for her. # There are rules in this file to deal with outgoing mail, but # it turns out there were some problems with getting bccs of # all outgoing mail here (it basically created a mail loop). # So, now, bccs of all emails are sent to user rhkmail. Procmail # for user rhkmail recognizes which are outgoing mails (from # rhkramer) and puts them in folders under user rhkmail. In the # future, I could make rhkmail a member of group dad, and then # rhkmail could put mail directly into dad's folders. I probably # won't bother with this for the time being. (Except now that # I said I won't, I probably will. ;-) ) # # #***************************************************************** # The Old Approach: # # The rule at DUPLICATE will make a copy of all emails which # reach that point for ruth # # Rules above DUPLICATE will move an email to one of my folders # (dad) and avoid making a copy for ruth # # Rules below DUPLICATE will move an email to one of my folders # (dad) but a copy has already been sent to ruth # # Emails that reach the end of the rules without being processed # remain in my (dad's) inbox # # # Folders are created in /home/dad/Mail automatically if # specified in a rule and they don't already exist. # # See EXAMPLES at the bottom of this file. # # *************************************************************** # MANDRAKE Lists :0: * ^TO_newbie@(linux-mandrake|mandrake-linux) lists/mn-new :0: * ^TO_expert@(linux-mandrake|mandrake-linux) lists/mn-exp :0: * ^TO_discuss@mandrakesecure lists/mn-sec :0: * ^TO_changelog@linux-mandrake lists/mn-chlg :0: * ^From:.*mandrakesoft daily/daily # ABIWORD Lists :0: * ^TO_abiword-\/(user|dev)@(abisource.com|nyorp.abisource.com) * MATCH ?? ()\/[^@]+ lists/abi-`echo "$MATCH" | tr [A-Z] [a-z]` # LVLUG Lists :0: * ^TO_\/lvlug lists/lv-lug :0: * ^TO_\/sig@thelinuxlink.net lists/lv-sig * Mahogany Lists :0: * ^TO_mahogany-(users|developers)@lists.sourceforge.net lists/mahog # DAILY AND MISC STUFF :0: * ^From:.*(Peter@Thoeny|tomalak|slashdot|scoop@kde|ZDNet Tech Update) daily/daily :0: * ^From:.*(lwn@lwn.net) daily/daily :0: * ^From:.*(csoenews|Akhter Ali) misc/cmp-hdw :0: * ^From:.*(Musician's Friend) misc/music # LINUX Lists :0: * ^To:.*lj-announce@ssc.com daily/linux :0: * ^From:.*(AppDevTrends|ENT@101|ESJ@101|IBM Developer Works|IBM Medium Business) daily/develop :0: * ^From:.*(IT_Insights|TechRepublic NetNote) daily/develop :0: * ^From:.*(SearchVB) daily/vbasic :0: * ^From:.*(Downloads Digest) daily/windows # *************************************************************** # Collect Sent Messages # *************************************************************** # # The following lines were going to be used to deal with bccs of # messages created so I made sure I collected a copy of all sent # mail whether from a pop3 or imap client. I now plan to collect # those by using the postfix =always_bcc= parameter to copy them # to a different user, created for that purpose. # # This avoids some potential difficulties -- if I bcc'd to myself # as dad@system8.home, I believe (test again) that the address would # come through as rhkramer@fast.net. If so, I would have trouble # distinguishing between (and handling properly) email intentionally # sent from ruth to herself for test purposes and the bccs sent # automatically to collect all sent messages. (One should be # forwarded to ruth, one should not.) # # Also, although I thought I tested this last night, today it creates # an infinite mail loop when I send something to myself as # rhkramer@users.sourceforge.net. Not sure how to kill the loop -- # I shutdown postfix with service postfix stop -- not sure what will # happen when I restart. # # Oops, OK -- one disadvantage of using bcc to another user and copying # messages from dad to ruth is that two bccs get sent for each incoming # message -- one for the original and one for the one forwarded email. # So, all in all, it might be better to switch to using the always_bcc # to forward two copies, and then have separate procmail filters for each # user, instead of trying to combine one procmail filter for dad and # ruth as I'm doing now. I guess that would be considered more scalable # as well. But, I'd better try a test with two always_bcc addresses # first. # # Oops2 -- OK, I guess I can't include two addresses in the always_bcc -- I # tried various formats and delimiters, ranging from alex ruth to # alex@system8.home(,|;) ruth@system8.home. So, rethink the plan. # # Also, test messages 33 and 34 haven't been received so far -- I suspect that # they got caught in the "exponential backoff delay" thingie when my # connection was down briefly. Two things -- I guess this argues for # the ping then sendmail -q approach on a cron job, and I don't know # how to look for these emails or kick them out of the queue. I tried # sendmail -q a little while ago, but the messages haven't arrived yet. # Send a copy of anything ruth sends to herself to her (except bccs) :0 c: * ^From:.*ruth.*rhkramer@fast.net * ^TO__ruth.*rhkramer@fast.net /var/spool/mail/ruth :0 c: * ^From:.*alex.*rhkramer@fast.net * ^TO__alex.*rhkramer@fast.net /var/spool/mail/alex :0 c: * ^From:.*rand.*rhkramer@fast.net * ^TO__rand.*rhkramer@fast.net daily/daily # LESLIE # Capture "to" mails for me. (Nothing I can do can capture bcc # Hmm, but if I write something for Leslie, how do I get a copy to ruth? # Send a cc or bcc? Either should work. # Note: After all of the specific captures, set up a capture for # all other, like From:.*ruth.*rhkramer@fast\.net # I guess I could modify the from to just capture From:.*ruth.*rhkramer@fast\.net # instead of From:.*rhkramer@fast.net # NOTE: Watch out for nested curly braces, which don't seem to # work, at least in the version of Procmail I'm using (stock # Mandrake 7.2). # If you do want to enclose the following in a broader "outer" # set of curly braces, you will have to modify the following. # After the following set of rules, I have the modified version # without the curly braces. # The "following": :0 c: * ^TO_OBFUSCATED { :0 c: * ^From:.*rand.*rhkramer@fast.net /var/spool/mail/ruth :0: * ^From:.*rhkramer@fast.net family/leslie } # The modified "following" without the curly braces -- note # that it "expanded" into two rules: :0 c: * ^TO_OBFUSCATED * ^From:.*rhkramer@fast.net family/leslie :0 c: * ^TO_OBFUSCATED * ^From:.*rand.*rhkramer@fast.net /var/spool/mail/ruth # End of the modified "following" :0 c: * ^From:.*OBFUSCATED family/leslie :0 A: /var/spool/mail/ruth # I think the following will: # Capture anything written by ruth and: # * Send a copy to ruth if she asked for a cc or sent it to herself # Oops, I better capture these before all her relatives! # * Send everything else she wrote to sent-ruth :0 c: * ^From:.*ruth.*rhkramer@fast.net ruth/sent # CRON DAEMON :0: * ^From:.*Cron Daemon daily/cron # *************************************************************** # *************************************************************** # # This is the old approach / plan! # # DUPLICATE: Make a copy of everything that reaches this point -- # send the original to ruth and keep a copy for the "runner" of # this file (dad) # # # Note: A better way to do this could be to set the bcc_always # parameter in the postfix main.cf file and then set up a # procmail file for that user. (Probably a little less confusing.) # # This does have the advantage of being able to easily prevent copying # someone else for emails that are irrelevant to someone else (by # storing them in a file above this line). # If I change the approach to send ruth only what she has requested # (rather than sending her everything that reaches this point unless # filtered out, I need to add lines like TO_ruth.*rhkramer@fast.net # :0 c: # * # /var/spool/mail/ruth # /home/ruth/mail/sent-mail # /var/spool/mail/ruth # Ah, the previous line seems to work as long as the file is rw by others # or probably if dad is part of a group that can write to the file. # But, something came along and reset the rw by others permission -- why # do I suspect msec? # ! ruth # *************************************************************** # *************************************************************** # HUMOR Lists :0 c: * ^From:.*keepAhead.*keepAhead.com daily/humor :0 A: /var/spool/mail/ruth # # *************************************************************** # KNOWN SPAM :0: * ^From:.*(100%Match Bonus|101funpages|88Happy88|AllFreeNews|AmericanBranding) trash-spam :0: * ^From:.*(CoverClicks|CosmicOffers|CustomOffers) trash-spam :0: * ^From:.*(DandyOffers|DirectOffers|DirecTV|Dish Deals) trash-spam :0: * ^From:.*(EBargains|Email4Luck|Email-Publisher) trash-spam :0: * ^From:.*(EmailWow|EmailOffers|Equalamail|FitnessHeaven|FoundMoney) trash-spam :0: * ^From:.*(GreatMailOffers|HomeSavings|IdealFinds|IPayDebt) trash-spam :0: * ^From:.*(JustForYou|KoolOffers|KooptMarketInc) trash-spam :0: * ^From:.*(MailCenter@vir|MailOffers|MailOfferz|MemberReward) trash-spam :0: * ^From:.*(Military Benefits|Money Making|MyLottoMail|MyNetOffers) trash-spam :0: * ^From:.*(OfferCheck|OneShare|PetCareRx|Print.?Pal|RadioStakes|rx_savings) trash-spam :0: * ^From:.*(SendOutMail|sexyjente.com|SmashingTrades|Top Special Offers) trash-spam :0: * ^From:.*(Super-Bargain|Super Blue Stuff) trash-spam :0: * ^From:.*(WorkFromHome|Your Opportunity) trash-spam :0: * ^From:.*(ValueMarketing) trash-spam # :0: # * ^From:.*() # trash-spam :0: * ^To:.*FreakyFreddie@topica.com trash-spam :0: * ^Reply To:.*mailcenter@virtumundo.com trash-spam :0: * ^Subject:.*(Antenna Reception Booster|AntiVirus|DirecTV0 trash-spam :0: * ^Subject:.*(Extra Income|Get Your Spot|Howard Stern|Inkjet & Laser Toner) trash-spam :0: * ^Subject:.*(Lose Weight|Paid To Shop|Problem Solved|Work From Home) trash-spam # PROBABLE SPAM :0: * ^Reply To:.*(topica.com) trash-probable-spam # *************************************************************** # # NOTES and EXAMPLES # # *************************************************************** # TO_ is a special procmail macro which matches: # * To: # * Resend-To: # * CC: # * # It does not match BCC: (because there is no BCC header # in received (or sent) emails -- the address for a bcc # is just added to the envelope address # TO is similar to TO_: # TO is like: ^To:.*string_to_match # TO_ is like: ^To:string_to_match # (note absence of "wild card" (.*)) # :0: # * ^TO_ newbie@linux-mandrake\.com # mandrake-newbie # TEMPLATE # :0: # * ^TO_\/(discuss|expert)@nedit\.org # # The previous line works whether the "." is escaped ("\.") or not. # # It results in $MATCH being "discuss@nedit.org" (or expert, which # # is a bogus name just for experimenting. # * MATCH ?? ()\/[^@]+ # # The previous line truncates everything after the first @, although # # I don't fully understand the syntax. I think you have to consider # # the ??, the (), \/, and [^@]+ as four different pieces of the puzzle. # # I think the [^@]+ matches anything until the first "@" sign. # # So far I know what the ?? or () do, the \/ is the extraction operator # # -- if there is a match it is put into a variable called $MATCH. # nedit-`echo "$MATCH" | tr [A-Z] [a-z]` # See: # * http://ii.best.vwh.net/internet/robots/procmail/qs/#extraction # * http://www.xray.mpe.mpg.de/mailing-lists/procmail/1999-12/msg00056.html # :0: # * ^TO_\/(discuss|expert)@nedit\.org # * MATCH ?? ()\/[^@]+ # nedit-`echo "$MATCH" | tr [A-Z] [a-z]` # Someday I'd like to make something like the following work, but it didn't # the first time I tried it. The advantage (intent) would be that it # could pick off arbitrary list names -- they would not have to be known # in advance. The one time I tried it, the list name came up blank, i.e., # "nedit-" instead of "nedit-discuss" (discuss@nedit.org was the address # of the list. # :0: # * ^TO_\/(.*)@nedit\.org # * MATCH ?? ()\/[^@]+ # nedit-`echo "$MATCH" | tr [A-Z] [a-z]` # ***************************************************************