procmail
[Top] [All Lists]

Re: Aim procmail at test mail-spool

1999-05-07 21:14:10
On 07 May 1999 13:13:10 -0700, Harry Putnam <reader(_at_)newsguy(_dot_)com> 
wrote:

A related question:  When using the {INCLUDERC=} line are
VAR values set in .procmailrc carried over to what ever
script is called?
  NO.

I'd like to safely aim procmail at a test mail-spool of my
own making to work out the recipes I want without slaughtering
real mail : )
  Here's how I do it.  First I create a subdirectory below my
$HOME, called "spamtest".  I "cd spamtest" before doing any
testing.  Here's part of the listing from "ls -al"

$ ls -al
total 2108
drwx------   2 waltdnes  user    1024 Apr 25 20:42 .
drwx--x--x  11 waltdnes  user    1536 May  7 22:58 ..
-rw-------   1 waltdnes  user     292 Apr 25 20:16 .proctestrc
-rw-------   1 waltdnes  user  154811 Apr 25 20:42 junkmail
-rw-------   1 waltdnes  user  141752 Apr 25 20:42 logfile
-rw-------   1 waltdnes  user     570 Mar 25 01:50 procvars
-rwx------   1 waltdnes  user     254 Oct  9  1998 t
-rw-------   1 waltdnes  user   53608 Apr 25 20:42 waltdnes
-rw-------   1 waltdnes  user  212592 Apr 25 20:15 ydata

 - I use ".proctestrc" as the test ".procmailrc" file.
   You can use any legal filename.
 - "junkmail" is where spam-suspect email is redirected
 - "logfile" is where diagnostics are logged.  If I'm
   testing/debugging, I'll generally have VERBOSE=YES
 - "procvars" is an include file that I often use
 - "waltdnes" is my $LOGNAME (from my account ID,
   waltdnes(_at_)interlog(_dot_)com )
 - my pseudo-mailspool is called "ydata"
 - the script "t" runs the tests, like so

  rm waltdnes
  rm logfile
  rm junkmail
  cat ydata | formail -e -s procmail -m ${HOME}/spamtest/.proctestrc

  It feeds the pseudo-mailspool to formail, which splits it into
the individual messages, and invokes an instance of procmail.
Note that procmail is told to use "${HOME}/spamtest/.proctestrc"
as the control file.  Here's what the beginning of .proctestrc
looks like...

PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
SHELL=/bin/sh
MAILDIR=$HOME/spamtest
LOGABSTRACT=NO
INCLUDERC=procvars
LOGFILE=$HOME/spamtest/logfile
ORGMAIL=$HOME/spamtest/$LOGNAME
DEFAULT=$ORGMAIL
VERBOSE=YES 

#
# blah, blah, blah.  Here's where my test recipe goes.
#

  Note that MAILDIR, LOGFILE, ORGMAIL, and DEFAULT have to be
changed in the test file to avoid clashing with your "real"
procmail processes.  Since I use "junkmail" as a relative
path+filespec, the change to MAILDIR redirects suspect email
to another directory than the one used by my "real" procmail.

-- 
Walter Dnes <waltdnes(_at_)interlog(_dot_)com> procmail spamfilter
http://www.interlog.com/~waltdnes/spamdunk/spamdunk.htm
Why a fiscal conservative opposes Toronto 2008 OWE-lympics
http://www.interlog.com/~waltdnes/owe-lympics/owe-lympics.htm

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