procmail
[Top] [All Lists]

SUMMARY: Echo replier: sending back headers and body

1996-03-21 08:54:50
On Tuesday 19 March 96, at 17 h 12, the keyboard of Stephane Bortzmeyer 
<bortzmeyer(_at_)pasteur(_dot_)fr> wrote:

But I would like to send back the headers (and may be the body) of the 
original message. 

I simply did not notice you can use formail -X without an header name to 
get all headers.

Now, I have the following recipe which works:

# Echo service
:0:/tmp/echo.procmail.lock
* ^To: *echo
* !^FROM_DAEMON
* !^X-Loop: echo(_at_)my(_dot_)dom
{

        HEADERS=`formail -X ""`
        BODY=`formail -I "" | sed 's/^/> /' `

        :0
        | (formail -rt -A"Precedence: junk" \
          -A"X-URL: http://www.my.dom/"; \
          -A"From: postmaster (Echo service)" \
           -A"X-Loop: echo(_at_)my(_dot_)dom" \
            ;\
          echo "Message received."; echo ""; echo "----"; \
          echo "Headers were: "; echo ""; \
          echo "${HEADERS}"; echo "";  echo "----"; \
          echo "Body was: "; echo ""; \
          echo "${BODY}"; echo "";  echo "----";\
          echo "Small ad..."; \
          echo "http://www.my.dom/";) | $SENDMAIL -t
}


Thanks to dattier(_at_)wwa(_dot_)com (David W. Tamkin) and "Karl E. Vogel" 
<vogelke(_at_)c17mis(_dot_)wpafb(_dot_)af(_dot_)mil> for the solution.

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