procmail
[Top] [All Lists]

Re: Echo replier: sending back headers and body

1996-03-20 03:31:32
On Tuesday 19 March 96, at 12 h 41, the keyboard of Doug Hughes 
<Doug(_dot_)Hughes(_at_)Eng(_dot_)Auburn(_dot_)EDU> wrote:

(Thanks!)

I think the man page quote from formail above pretty much sums it up.
for sending back the body, also see the -k flag for formail.

OK, '-k' preserves the body and nicely quotes it. I've missed that option.

Having the header quoted as part of the body of your reply might be
a little tougher. One way to do it would be to use variables to
store elements of the header with formail -x.

The big problem is that I want ALL the headers even funny custom things 
like X-Zippy. I don't want to enumerate all possible headers.

HEADER=`formail -X Subject: -X From: -X To: -X Date: -X Sender .. etc`
and then you can echo it back in your second formail.

OK, I can use the following recipe but the main problem is that I'm 
forced to know the headers I want to keep:

# Experimental echo service
:0:/tmp/echo.procmail.lock
* ^To: *echo2
* !^FROM_DAEMON
* !^X-Loop: echo(_at_)my(_dot_)domain
{
        HEADER=`formail -X Subject: -X From: -X To: -X Sender -X Received`

        :0
        | (formail -rtk -A"Precedence: junk" \
          -A"X-URL: http://www.my.domain/"; \
          -A"From: postmaster (Experimental Echo service)" \
           -A"X-Loop: echo(_at_)my(_dot_)domain" \
            ;\
          echo "OK"; \
          echo "Your headers: "; \
          echo $HEADER; echo ""; \
          echo "Small ad"; \
          echo "http://www.my.domain/";) | $SENDMAIL -t
}


Stephane Bortzmeyer           Institut Pasteur
bortzmeyer(_at_)pasteur(_dot_)fr         Service d'Informatique Scientifique
                              Paris, France
+33 1 40 61 34 62

http://web.cnam.fr/personnes/bortzmeyer/home_page.dom