procmail
[Top] [All Lists]

flaky recipe -- too bad it's not for pastries

2003-02-07 01:24:49
Hello, I am having a few problems with the "centerpiece" of my .procmailrc

1) Usually it works, but approx 5% of the time, it will let addresses not on my 
whitelist slip through.

2) When it works, the autoresponder usually gets the message off, but once in a 
while, I get the Error while writing to "x" message listed in the procmail man 
page.  My interpretation of the man page leaves me with "pipe died" as the only 
possible cause.  Why would the pipe die?

3) When the autoresponder fails, I would expect output to either go into the 
REPORT variable or into the redirect file named ERRORmsg.xxxx.  Both are always 
blank.

4) When the autoresponder succeeds, I would expect processing to be complete, 
but there is always another copy left over, which is why I have the blacklist 
recipe at the end.

5) In case you're wondering, the echo's are there because formail refuses to 
add those fields no matter which flag [AaIi] I use :-(


Here are the recipes in question, with names changed for privacy:


:0D
* ^To: .*REDEEM\/msg\(_dot_)[^(_at_)(_dot_)/]+
| cat $MAILDIR/nonwhitelist/$MATCH >> $MAILDIR/review

:0B:
* ^X-Loop: procmail(_at_)lastname(_dot_)com
blacklist

:0
* ^To: \/.*
* ! ? formail -rzxTo: | fgrep -iwqsf $HOME/whitelist
* ! ? formail -rtzxTo: | fgrep -iwqsf $HOME/whitelist
{
  SENTTO="$MATCH"

  :0c:
  nonwhitelist
  # cron will delete nonwhitelist messages after they are one week old

  LASTMSG=`echo $LASTFOLDER | sed -e "s#.*/##"`

  :0W
  * !^FROM_DAEMON
  * !^X-Loop: procmail(_at_)lastname(_dot_)com
  REPORT=| (formail -q- -r \
      -XSubject: \
      -XTo: ; \
     echo "From: \"firstname lastname\" 
<REDEEM${LASTMSG}(_at_)lastname(_dot_)com>" ; \
     echo "Reply-To: \"firstname lastname\" 
<REDEEM${LASTMSG}(_at_)lastname(_dot_)com>" ; \
     echo "X-Loop: procmail(_at_)lastname(_dot_)com" ; \
     echo ; echo "Hello, you sent a message with the above subject to $SENTTO" 
; \
     cat $HOME/autoreply.text ; \
    ) 2>>ERROR${LASTMSG} | $SENDMAIL $SENDMAILFLAGS -t 2>>ERROR${LASTMSG}

  :0ew
  {
    LOG="$NL### Autoresponder failed.  more $HOME/Mail/whitelist/$LASTMSG $NL"
    LOG="### $FROM_ $FROM $SUBJECT $NL"
    LOG="$NL$REPORT$NL"
  }

  :0:
  * ^FROM_DAEMON
  | cat >> reviewlist
  # cron will NOT delete reviewlist messages after they are one week old

  :0:
  blacklist
}

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