Philip wrote:
Gary wrote:
You might try the following recipe:
:0 fhw
| (formail -X From -X From: -X Subject: -X Date: ; echo "")
The "-X From" is optional, but needed if you want the
resulting message
to be well-formed. Likewise the 'echo ""' is needed to
ensure that the
header terminates with a blank line.
The "-X From" should include a quoted space to avoid matching on any
header field that starts with "From". The echo can be eliminated by
instead giving formail the -k option, so that it will
preserve the blank
line that ends the header:
:0 fhw
| formail -X"From " -XFrom: -XSubject: -XDate: -k
Since procmail can invoke formail in that action directly
without using
a shell, it'll be more efficient.
Thanks Philip. As an aside, the formail documentation says the following
about the -k switch:
-k When generating the auto-reply header or when extracting
fields,
keep the body as well.
Since we're only feeding the (blank-terminated) header to formail,
isn't it a bit of reach to expect -k to pass the blank line at the end
of
the header along? Seems like the formail documentation could be clearer
on this. Although the man page does note this usage:
To remove all fields except From: and Subject: from the header:
formail -k -X From: -X Subject:
When I read this, I assumed it was being applied to the
entire message (header and body), and in this context the -k switch made
sense.
[Though, strictly speaking, perhaps -X"From " should be added to the
switches above?]
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail