procmail
[Top] [All Lists]

Re: Auto-Reply with all headers

1997-02-18 18:55:39
On Tue, 18 Feb 1997, Roy Rapoport wrote:
Howdy, all.  I'm sure this must have been done before, but I'm
looking to implement an auto-reply mechanism that will basically do
something like send the original poster a message of the form

Your message was received by <whoever> in this form, including all
headers and the body:

<All headers>
<body>

Roy, there are a number of ways to do this, and here is one way that I
currently send autoreplies as you describe with the original full
header and body pasted below. I edited this and commented it after
pasting into this reply. I offer it to illustrate how this can be
done, and you'll want to modify for your use. 

Also see Alan Stebbens' autoack examples found at: 
                                        http://reality.sgi.com/aks

David Hunt <dnhunt(_at_)rain(_dot_)org>
##############################################################
        # Set the path to my canned message.
        MESSAGE_FILE=[path to file containing your canned message]

        # Make a copy of the mail for the nested block. The original
        # proceeds through procmail to spool, unless redirected.
        :0c
        * some conditions as needed.
        * !^X-Loop:(_dot_)*user(_at_)host(_dot_)domain
        {
                # Set the tempfile to use.
                TMP=/[path to some directory]/$$

                # Copy the header to the tempfile.
                :0ch
                $TMP

                # Create a reply message from the header of the
                # original. Append your message. Append the original
                # header from the tempfile. Since we are only
                # filtering the header, original body will append
                # unaltered as the reply exits the filter.
                :0fhiw
                | ( formail -brtz -A "X-Loop: user(_at_)host(_dot_)domain" ; \
                cat $MESSAGE_FILE ; cat $TMP )

                # Remove the tempfile.
                COMMAND=`rm $TMP`

                # Give the reply to sendmail for mailing.
                :0
                ! -t
        }
##############################################################





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