procmail
[Top] [All Lists]

Online Procmail Workshop

2003-07-07 10:18:23
Hi everyone -

I put together an online mail filtering workshop for students here
and was hoping get some expert feedback:

http://cs.oregonstate.edu/~creelan/procmail.html

A lynx dump of the first chapter is also appended below.

Thx!

-TFC

--

   OSU-ACM Electronic Workshops:
   Prev Section x. Mail Filtering Next
   ______________________________________________________________________
   
0.0. Intro

   Procmail filters your email. The aim of this workshop is to get you up
   and filtering email with procmail quickly, while explaining the syntax
   so it doesn't
   remain a complete mystery, and introducing debugging techniques. We
   begin by reviewing the college of engineering's guide to
   spam-filtering, which  introduces procmail syntax, recommended
   recipes, and installation info:
   [1]http://engr.oregonstate.edu/computing/faqs/spam.html
   The first thing you should do is skim this site and determine what
   procmail is and set it up. Your needs and ability to catch on may be
   such that this site is all you need, however we recommend also
   learning how to debug procmail for when things go wrong, and get a
   grasp of regular expressions and scoring. The purpose of this workshop
   is to supplement other sites. We assume a familiarity with [2]unix
   fundamentals.
   Quiz
   1. Everything tagged by "Spamassassin" is spam. (True/False)
   2. What file are procmail recipes stored in?
   ______________________________________________________________________
   
1.0. Logging In

   SSH into a machine with the same account you receive or collect email
   on. For example, OSU CS students go to "jasper", for ENGR use
   flop.engr.orst.edu, and general OSU students can try onid.orst.edu.
   Exploration: 
   What type of mail server do you use - sendmail, exim, etc? What OS
   does it run on?
   ______________________________________________________________________
   
1.1. Ramping up for Procmail

   At the prompt, use wget to download the [3]procmail kit for this
   workshop, and unarchive it:
   
   Example 1-1. Installing the Kit.
$ wget http://cs.oregonstate.edu/~creelan/procmail-kit.tar.gz
$ tar xzvf procmail-kit.tar.gz

   Syntax Highlighting
   If you use emacs or vim (recommended), you should configure procmail
   syntax highlighting. Do this for vim by copying the files from the kit
   into your home directory:
$ cp procmail-kit/syntax/dot.vim ~/.vim
$ cp procmail-kit/syntax/dot.vimrc ~/.vimrc

   Alternately, if you already have a .vimrc file, simply ensure "syntax
   on" is enabled in your file, copy the proclog.vim file into
   $VIM/syntax, and put this in your $VIM/filetype.vim file:
        " my filetype file
        if exists("did_load_filetypes")
          finish
        endif
        augroup filetypedetect
          au! BufRead,BufNewFile *.rc         setfiletype procmail
          au! BufRead,BufNewFile *.log        setfiletype proclog
        augroup END

   For Emacs, specify the filetype as shell mode and ensure font-lock
   mode is on in your .emacs file, as outlined below, or download
   [4]tinyPM.el.
    (setq auto-mode-alist
          (cons '("\\.rc$" . sh-mode) auto-mode-alist))
    (setq auto-mode-alist
          (cons '("\\.procmailrc$" . sh-mode) auto-mode-alist))
   ;; Make sure you have font-lock mode on:
           (custom-set-variables
             ;; Your init file should contain only one such instance.
            '(global-font-lock-mode t nil (font-lock)))
            '(font-lock-mode t)
   Shortcut Functions
   Some operations will be performed continually while debugging our
   procmail recipes so it helps to have shortcuts to do them. If you use
   bash add the following function to your .bashrc:
# ---------------------------------

# simulate delivery of a message to ~/.procmailrc

# ---------------------------------

forproc() {
        if [ "$1"]; then
                formail -s procmail -a "testing" < $1
        else
                echo "Usage: forproc MAIL_FILE " >& 2
        fi
}
# view today's log

alias proclog="vi ~/.procmail/log/$(date +%b_%Y)/$(date +%m_%d_%Y).log"
   ______________________________________________________________________
   
1.2. Email Format

   Let's start by examining the format of email messages.  First examine
   the file extra/sample.mbx with your editor. You'll notice a section
   containing headers and a section where the body of the message read by
   people is stored. Most email clients like pine mask the headers so
   only To or From are displayed, although you can view all the headers
   under pine and mutt by pressing 'H'.

[snipped remainder]

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>