procmail
[Top] [All Lists]

Fighting with the use of variables in .procmailrc

1999-06-08 09:41:24
Hello everybody.

I am trying to use procmail to send back a different mail message,
depending on the value of a variable which is set inside a perl script
(so it has to be an environment variable).

Here is my .procmailrc file (the login shell is tcsh) :

set VERBOSE=on
set MONTHLOG=`date +%y-%m`
set LOGFILE="log/"$MONTHLOG"_procmail.log"
set LOG_MONTH="log/"$MONTHLOG"_received.log"
set SENDER=`formail -rtzxTo:`
set SUBJECT=`formail -xSubject:`
set TMPFILE="/home/tmp/registmp-$SENDER"
setenv ALLR_REG="FALSE"
 
:0w:
| bin/test_registrd_usr.pl $SENDER > $TMPFILE 

:0:
* ALLR_REG ?? FALSE
| (formail -rk \
-I "To: $SENDER" \
cat $TMPFILE ; rm -f $TMPFILE) | $SENDMAIL -t -oi

:0:
* ALLR_REG ?? TRUE
| (formail -rk \
-I "To: $SENDER" \
echo "Your request is being processed" ; setenv ALLR_REG FALSE) |
$SENDMAIL -t -oi

So what I want to do is a simple test on the value of the variable
"ALLR_REG"
When sending a mail, I never get anything back.

In the procmail log file, I get :

procmail: Assigning "set"
procmail: Assigning "LOG_MONTH=log/99-06_received.log"
procmail: Assigning "set"
procmail: Executing "formail,-rtzxTo:"
procmail: [7053] Tue Jun  8 18:28:52 1999
procmail: Assigning "SENDER=user(_at_)site(_dot_)net"
procmail: Assigning "set"
procmail: Executing "formail,-xSubject:"
procmail: Assigning "SUBJECT= request"
procmail: Assigning "set"
procmail: Assigning "TMPFILE=/home/tmp/registmp-user(_at_)site(_dot_)net"
procmail: Assigning "setenv"
procmail: Assigning "ALLR_REG=FALSE"
procmail: Locking "log/99-06_received.log.lock"
procmail: Assigning "LASTFOLDER=log/99-06_received.log"
procmail: Opening "log/99-06_received.log"
procmail: Acquiring kernel-lock
procmail: Unlocking "log/99-06_received.log.lock"
procmail: Locking "log/99-06_received.log.lock"
procmail: Couldn't determine implicit lockfile from "
bin/test_registrd_usr.pl 
$SENDER > $TMPFILE "
procmail: Locking ".lock"
procmail: Executing " bin/test_registrd_usr.pl $SENDER > $TMPFILE "
procmail: [7053] Tue Jun  8 18:28:53 1999
procmail: Assigning "LASTFOLDER= bin/test_registrd_usr.pl $SENDER >
$TMPFILE 
"
procmail: Unlocking ".lock"
From user(_at_)site(_dot_)net  Tue Jun  8 18:28:51 1999
 Subject: request
  Folder:  bin/test_registrd_usr.pl $SENDER >
$TMPFILE                    910
procmail: Notified comsat: "account@: bin/test_registrd_usr.pl $SENDER >
$TMPFILE
 "

and nothing more.
So I see no trace of the test in the log file and no message is sent.

Could some one help me in understanding what is wrong and how I should
use the environment variable ?


Thank you in advance,
 Bernard Debray
 debray(_at_)obs-besancon,fr
 Observatoire de Besancon
 France

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