procmail
[Top] [All Lists]

Re: Autoreply of processed messages

1998-05-26 02:16:29
I'm replying to my own question:

I'm trying to set up a service that will feed inputs through a program
and mail the output back to the sender.

because the answer involves tips that I got from this list.  It's so
simple that I wonder why it took me a week.

My .procmailrc for this 'user' looks like this:


SENDMAIL = /usr/sbin/sendmail

:0
* !^FROM_DAEMON
* !^X-Loop: $USER(_at_)$HOST
{ # shell script `pipe` sends stdout if exit code 0, else stderr
   
  :0 fbw :              
  | pipe
                
  :0 fhw              # reverse mailheader and extract name
  | formail -rA "X-Loop: $USER(_at_)$HOST"

  :0 a
  | $SENDMAIL -oi -t
}

:0
/dev/null

I'm not too sure it works if mails come thick and fast: `pipe` uses
temporary file names that are not unique, and I'm hoping that the second
colon on its recipe stops a new mail from executing the recipe until the
first one is finished.

Dirk

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