Stephane Bortzmeyer <bortzmeyer(_at_)pasteur(_dot_)fr> writes:
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.
You're going to have to make a copy of the headers somewhere for this,
as formail needs a copy and the body of the message needs a copy.
:0:header.temp.lock
* ^TO_echo2
* ! ^FROM_DAEMON
* ! ^X-Loop: echo(_at_)my(_dot_)domain
|cat >header.temp; \
( formail -rt -A"Precedence: junk" \
-A"X-UTIL: http://www.my.domain/" \
-A"From: postmaster (Experimental Echo service)" \
-A"X-Loop: echo(_at_)my(_dot_)domain" <header.temp; \
cat intro.message header.temp \
) | $SENDMAIL -t
The contents of intro.message will appear at the top of the outgoing
message, followed by the *complete* message as received. If you want
to strip headers from the message in the body, you should replace the
line with the second 'cat' command with:
cat intro.message; formail -IWhatever: \
There are other various tweaks that can be made to this, but the basic
idea is that you're going to have to save the headers to a file, and
pull them back out again. The above saves the entire message, which
means that you may want to place a size restriction on this service
(actually, you should do that anyway, as someone can always create
20Megs of headers if they wanted).
...
# Experimental echo service
:0:/tmp/echo.procmail.lock
...
{
Local lock files don't do anything on nested block actions. You have
to use a global lock inside the block if you want to lock over
everything in the block.
Philip Guenther
----------------------------------------------------------------
Philip Guenther UNIX Systems and Network Administrator
Internet: guenther(_at_)gac(_dot_)edu Voicenet: (507) 933-7596
Gustavus Adolphus College St. Peter, MN 56082-1498
Source code never lies (it just misleads). (Programming by Purloined Letter?)