procmail
[Top] [All Lists]

Re: auto-responder that quotes message header & body

2000-10-11 09:54:00
lewst wrote:
I've implemented an auto-reply recipe, but want to quote the original
message (including headers) below the echo lines, and the message

Here's how I'd start.  This is UNTESTED, YMMV, etc...

    # The following conditions are unchanged.  I don't think the local 
    #    lockfile will do you any good here.
    :0
    * !^FROM_DAEMON
    * !^X-Loop: lewst(_at_)corp(_dot_)com
    * ^TOmelissa\(_at_)corp(_dot_)com
    {

        # Don't modify original header, just put a few fields in $RH

        :0hi
        RH=|formail -rt "-IPrecedence: junk" \
                    "-AX-Loop: lewst(_at_)corp(_dot_)com" "-IFrom: 
postmaster(_at_)corp(_dot_)com"

        # Create a message containing the above $RH, your 2-liner,
        # and then the entire message, quoted.  

        :0
        | (echo "$RH"; echo; \
           echo "Returned mail: User not local;" ; \
           echo "please try <melissa(_at_)virtual(_dot_)com>" ; \
           echo ; \
           sed -e 's/^/> /' ) | $SENDMAIL -oi -t
    }

Regarding why "formail -rt" rather than just "-r"...

http://www.procmail.org/jari/pm-tips-body.html#always_use_formails_rt_switch 

cheers
-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.

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