procmail
[Top] [All Lists]

Re: Hacking stdin? (Why doesn't this filter do what I expect)

1997-05-08 00:58:00
On Thu, 8 May 1997 00:55:03 -0400 (EDT),
Robert Nicholson <steffi2(_at_)dgs(_dot_)dgsys(_dot_)com> wrote:
I want to do this without relying on temporary files.

David Tamkin posted a neat-o sed script for that some time ago. It
grabs the header into the hold space, then at the end of the headers,
spews out a copy of the hold space, thus generating duplicate headers
so you can consume one in formail and continue processing in the
"body" which will now conveniently start with a second copy of the
headers.
  I can't reconstruct that off the top of my head, but I should have a
copy of the message on file. You should also be able to pick it up
from the list archive.

             :0f
                | $FORMAIL -rtz \
                        -I "Subject: Re: $SUBJECT [rejected]" \
                        -A "X-Loop: robert(_at_)elastica(_dot_)com" \
                        -I 'Content-Type: multipart/mixed; boundary="--
next item --"' ;\

This consumes stdin. You can use the -kb flag to at least preserve the
body, and feed the output into sed to insert your little message at the
separator between the header and the body. (Should save a bunch of
processes compared to the original, too.)

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>