ProcmailFilter

From MyLinuxNotes

Jump to: navigation, search

assassination kennedy video large breasted videos creampie eating men invisible movie trivia japenese millington tn popcorn machine temple bells on the rocks movie trichelle pre war maps of germany spanking video sites father and daughter having sex mcog torrents real estate analysis free graduation poems ephedra diet pcconnection promotional codes sec.gov playboy mansion game actonel jaw decay yankees suck porn haitian video who moved my cheese pizza frenzy gamehouse serial indiana oxycontin lawyer new jersey lawyers top webmap powerful video cards bushmaster firearms zoloft the rock and roll destroyer lyric top plato sodering products electronic arts video game Check out http://www.procmail.org/ for more information.

When using mutt I used procmail to filter my mail. It did a very good job at filter spam, sorting my mail into folders, and playing sounds when mail went into certain folders. Notice I put spam into "spam" folder instead of /dev/null just to be safe.

Contents

Here is an example of a .procmailrc file:

  # Directory for storing procmail configuration and log files
  PMDIR=$HOME/Procmail

  # Put ## before LOGFILE if you want no logging (not recommended)
  LOGFILE=$PMDIR/log

  # Set to yes when debugging
  VERBOSE=yes

  # Remove ## when debugging; set to no if you want minimal logging
  #LOGABSTRACT=all

  # For privacy, have procmail create mailboxes with 600 (-rw-------) permission
  UMASK=077

  # Replace $HOME/Msgs with your message directory
  # Mutt and elm use $HOME/Mail
  # Pine uses $HOME/mail
  # Netscape Messenger uses $HOME/nsmail
  # Some NNTP clients, such as slrn & nn, use $HOME/News
  # Mailboxes in maildir format are often put in $HOME/Maildir
  MAILDIR=$HOME/Mail       # Make sure this directory exists!

  # Keeping my scripts a little organized.  These are parsed first.
  INCLUDERC=$PMDIR/mail_filter.rc
  INCLUDERC=$PMDIR/lists.rc
  INCLUDERC=$PMDIR/spam_filter.rc

  # Plays a sound when mail hits the inbox
  :0:
  {
      :0 c
      inbox

      :0 i
      |/usr/bin/play /usr/share/sounds/gnobots2/splat.wav
  }

Here is mail_filter.rc:


  :0:
  * (^((Original-)?(Resent-)?(To|Cc|Bcc|From)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?).*me@myemail\.com
  {   
      :0 B:    #Anything sent to me that has the following in the body goes in the trash
      * ^.*nothing\ to\ report
      /dev/null

      :0 c:   
      my-mail  #Otherwise it goes into this mailbox

      :0 i     # and a sound is played
      |/usr/bin/play /usr/lib/games/xpat/audio/success.wav
  }

  :0:          #next two rules take care of mail that I want that isn't sent directly to me
  * ^subject:.*Anacron\ job\ \'cron\.daily\'
  inbox

  :0:
  * ^from:.*\<info@enter\.net\>
  inbox

Here is lists.rc

  # These rules sent all my maillists to the proper mailbox
  :0:
  * (^TO_|^Reply-To:).*plug(\-announce)?@lists\.phillylinux\.org
  plug

  :0:
  * ^.*(mailto:)?bugtraq@securityfocus\.com
  bugtraq

  :0:
  * ^TO_.*cert\-advisory@cert\.org
  bugtraq

  :0:
  * ^.*(mailto:)?focus-linux@(lists\.)?securityfocus\.com
  focus-linux

Here is spam_filter.rc

  :0:   #  If it's not sent to me put in spam
  * !^(to|cc|bcc):.*me@myemail\.com
  spam

  :0 HB  # Searches the body and header for common spam terms
  * (viagra|boost\ your|competitive\ interest\ rates|Debt\ Consolidation|(Pher[-]?o[-]?mone)|College\ Scholarships|Financial\ Aid|Get\ Rid\ of|
  Web\ Detective|I\ LOVE\ YOU\ AND\ I\ DON'T\ WANT\ YOU\ TO\ DIE|credit\ problems|100%\ Legal|bankruptcies|filed\ for\ bankruptcy|Internet\ Mar
  keting|millionaire|HotDeals@reply\.pm0\.net|hotdeals@powersportsinc\.com|Judicial\ Judgement|Foreign\ Currency\ Market|Multi-?million)
  spam

  :0:  #Takes care of spam that has my username followed by many different doamins
  * ^TO_.*me@[^(myemail\.com)]
  spam

  :0:  # Takes care of spam sent to many users at my domain
  * ^(to|cc):.*(\S*@myemail\.com.*\S*@myemail\.com.*\S*@myemail\.com)
  spam

  :0 H  # This type of message is almost always spam
  * ^Content\-Type\:\ text/html
  spam
Personal tools