procmail tips and tricks

Hal Burgiss hal at burgiss.net
Sun May 10 00:01:19 UTC 2009


Any procmail users? Anyone want to share tips on how to take back
control of your inbox from trolls, and other lesser lights? 

Below are some recipes I've accrued over time, but would love to add
to it. 

I also have a mutt macro that dynamically creates a procmail recipe
based on the subject of the email. Great for killing threads that
won't die any other way. 

# Lists annoyances.
  :0
  * ^Sender: ubuntu-users-bounces at lists.ubuntu.com
  {
       LOG="ULIST: "
       
       # HTML enabled mail. Bad idea.
       :0 BH
       * ^Content-Type:.*(text/html|multipart/(alternative|mixed))
       { LOG="HTML: "
         
         :0
         /dev/null
       }

#        # check excessive line lengths and chronic non-trimmers
#        :0B 
#        * ? /usr/local/bin/linelen.pl
#        { LOG="linelen.pl: "
# 
#          :0:
#          /tmp/testing.mail
#        }
       
       # Oh, PLEASE!!!!
       :0 
#       * ^Subject: +(Re: )?unsub?scribe
       * ^Subject: +(Re: |Fwd?: |SV: |\* )*(please |how do I)?un-?(su)?b?scr?ibe
       /dev/null
       
       # Get rid of self proclaimed noobies.
       :0 
       * ^Subject: +(Re: |Fwd?: |SV: )*n(ew|oo|00)b(ie|y|ee)?
       /dev/null
       
       # No subject, tough noogies!
       :0 
       * ^Subject: +(Re: |Fwd?: |SV: )*(\(no subject\))? *$
       /dev/null
       
       # Bad subject, does not tell me a thing.
#       * ^Subject:.*list digest, Vol
       :0
       * ^Subject:.*list digest
       /dev/null

       :0
       * ^Subject: +(Re: |Fwd?: |SV: )*Invalid account
       /dev/null
       
       # Not descriptive enough :(
       :0
       * ^Subject: +(Re: |Fwd?: |SV: )*(please )?h ?e ?l ?p ?(please )?\!*$
        { LOG="helpme: "
         
         :0
         /dev/null
        }

       # upper case test
       :0D
       * ^Subject: +(Re: |RE: |Fwd?: |SV: )*.*HELP
        { LOG="helpme2: "
         
         :0
         /dev/null
        }

       :0
       * ^Subject: +(Re: |Fwd?: |SV: )*(easy |small |quick |some)*Questions?( again)?\.*$
        { LOG="Question: "
         
         :0
         /dev/null
        }
        
       :0
       * ^Subject: +(Re: |Fwd?: |SV: )*(small |weird |strange)*problems?(\.|!)*$
        { LOG="Problemo: "
         
         :0
         /dev/null
        }

       :0
       * ^Subject: .*(out of (the )?office|automated response)
       /dev/null
       
       :0
       * ^Subject: +(Re: |Fwd?: |SV: )*test( message| post(ing)?)?$
       /dev/null
       
       # Ed Wilts <ewilts at ewilts.org> single word subject.
       # Bag any one word subject lines. Can't be telling me enough.
       :0
       * ^Subject: (Re: |Fwd?: |SV: )*[A-Za-z0-9\,\._\-\!:;\"\'\?/]+$
        { LOG="one word: "
         
         :0
         /dev/null
        }

       # All CAPS, GMAFB ;-)
       :0D
       * ^Subject: (Re: |Fwd?: |RE: )*[A-Z0-9 \,\._\-\!:;\"\'\?/]+$
        { LOG="CAPS: "
         
         :0
         /dev/null
        }

       # cluelessness
       :0
       * ^From: root@
        { LOG="Rootdude: "
         
         :0
         /dev/null
        }
        
       # It can't be *that* damned important.
       :0
       * ^Subject:.*urgent
       /dev/null
}

-- 
Hal




More information about the ubuntu-users mailing list