procmail
[Top] [All Lists]

Re: auto-replying -- sending back the _headers_

1997-03-26 21:00:06

On March 26, 1997, "Timothy J. Luoma" <luomat(_at_)peak(_dot_)org> said:

I am helping a few people debug their sendmail configs.  They are  
trying to make sure all their headers are in the right order, etc.

I would like to be able to setup a thing where they could send me a  
message with a certain subject and get an automated response -- but  
the response would/should include all the headers from their  
original message (so they can check out their 'From ' lines, etc.)

[ Note: they are using 'Reply-To' lines so there will be a valid  
address available for the autoresponder....]

I was thinking it would be something like this:

:0fb
* ! ^X-Loop: luomat(_at_)peak(_dot_)org
* ^Subject:[    ]SendAReply
|(formail -rt -I"From: TjL AutoReplier <luomat(_at_)peak(_dot_)org>" \
       -I"Precedence: junk"  \
       -I"X-Loop: luomat(_at_)peak(_dot_)org" )|$SENDMAIL -oi -t

but that and various other things I tried resulted in nothing close  
to what I was looking for.

I searched back messages but nothing about sending back the headers  
(sending back the body is most common, but I wasn't able to hack  
that into working for the headers either).

Check this out:

#Set on when debugging
VERBOSE=off
:0c
* !^X-Loop:(_dot_)*postmaster(_at_)aonix(_dot_)com
{
        # Set the tempfile to use.
        TMP=/tmp/$$
        # 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
        | ( /usr/procmail/bin/formail -brtz \
                -i"Subject: Automatic Bounce Of Your Message" \
                -i"From: The MailTest Program
<postmaster(_at_)aonix(_dot_)com>" \
                -A "X-Loop: postmaster(_at_)aonix(_dot_)com" ; cat $TMP )
        # Remove the tempfile.
        COMMAND=`rm $TMP`
        # Give the reply to sendmail for mailing.
        :0
        ! -t
}

-roy
           Roy S. Rapoport / rsr(_at_)aonix(_dot_)com / phone:415-543-0900
               Email rsr+services(_at_)aonix(_dot_)com for info on how
                to contact me, get my PGP public key, etc.
      Paul Vixie took my pen and all I got was this lousy .signature