procmail
[Top] [All Lists]

Re: Multiple cat's in formail pipe?

1999-09-29 01:33:29
On Tue, 28 Sep 1999 13:45:32 -0500, David Stone
<dstone(_at_)chem(_dot_)utoronto(_dot_)ca> wrote:
:0c:
$PMDIR/temp

:0c: $PMDIR/temp.lock
| ($FORMAIL -rt -I "Subject: Your recent mail" \
     -A "X-Loop: $LOGNAME" \
     -A "X-Comment: Auto-acknowledgement";\
        echo "blah";\
     echo "blah";\
     echo "blah";\
     echo " ";\
     cat $PMDIR/temp;\
     rm -f $PMDIR/temp) \
     | $SENDMAIL -oi -t

What I would LIKE to do is include a cat $PMDIR/autoack.txt
ahead of the copy of the received mail generating the autoresponse
so that the message can be varied without having to mess directly
with the procmailrc file. I keep getting an "unexpected end of
file" error when I do this, however, no matter what I seem to try.

Sounds like you simply forgot to put in the backslash. But you could
avoid the temp file altogether.

    :0c
    * ! $ ^X-Loop: $\LOGNAME
    * ^Subject:\/.*
    | ( formail -rt -I "Subject: Autoreply (was: $MATCH)" \
            -A "X-Loop: $LOGNAME" \
            -I "Precedence: junk" \
            -A "X-Comment: Auto-acknowledgement" ; \
        echo blah ; echo blah ; echo blah ; \
        cat $PMDIR/autoack.txt ; \
        echo ; \
        cat - ) $SENDMAIL -oi -t

Some of the changes I made are more or less gratuitous, others are
important.

  * I hate autoresponders which zap the original Subject entirely. I
    changed it so it includes the original Subject in parens. This
    will fail if you ever receive mail which doesn't have a Subject:
    header (but this is somewhat unlikely to happen, as such mail
    breaks RFC822 and Sendmails all over the world will probably
    automatically add an empty Subject: header)
  * You should always include Precedence: in automatically generated
    mail
  * The X-Loop: header is useless if you don't also take care not to
    respond to mail with this header already in it
  * I left in some of the echos just to show that you can put anything
    you like inside the parens. Presumably your autoack.txt would
    already contain everything (perhaps including some headers) and
    the whole thing should look more like

        :0c
        * (same conditions)
        | (formail etc etc ; cat $PMDIR/autoack.txt - ) | $SENDMAIL -oi -t

You will find numerous examples of similar recipes in the archives.
Check out <http://www.rosat.mpe-garching.mpg.de/mailing-lists/procmail/>

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition