Subject: Re: escaping From_ (was: forwarding header info only)

From: Roman Czyborra <[email-masked]>
Date: Thu, 10 Feb 1994 06:39:17 +0100

> >	    sed '1s/^From />From /' ) | $SENDMAIL -oi -t

The advantage of this traditional Unix escape is that you could even
handle it with formail if you wanted to. I'm changing my suggestion to

	: ch
	* ...
	| (echo Subject: auto-note ; cat) \
	| formail -a "To: wz40ft" -a"X-Loop...: $MEHERE" \
	| $SENDMAIL -t

Dan Smith suggested:

> Or something along the following lines for a MIME-compliant message
> The primary advantage here is that "From" doesn't need to be escaped;
> of course you'll need a MIME-compliant MUA, otherwise you'll see
> '=46rom' instead of 'From'...

That is a nice idea too.

> 	| ( echo "To: [email-masked]"; \
> 	    echo "Subject: auto-note"; \
> 	    echo "X-Loop($WHEN.$$): $MEHERE"; \
> 	    echo ""; ) | \
>             formail -a "MIME-Version: 1.0" \
>                     -a "Content-Type: text/plain; charset=iso8859-1" \
>                     -a "Content-Transfer-Encoding: quoted-printable" | \
>             sed '1s/^From /=46rom /' | $SENDMAIL -oi -t

This won't work though.  The header would not be included unless you
moved the sed after the echo ""; as it is now it would produce a
=43rom foo@bar likely to choke sendmail. At any rate, equal signs in
the message would have to be substituted also to survive the
q-p-decode, and iso-8859-1 is overlabeling it a bit. For that purpose
I'd say

NEWHEADER="To: [email-masked]
Subject: auto-note
MIME-Version: 1.0
Content-Type: message/rfc822
Content-Transfer-Encoding: quoted-printable
X-Loop($WHEN.$$): $MEHERE
"

: ch
* ...
| (echo "$NEWHEADER"; mmencode -q | sed '1s/^F/=46/') | $SENDMAIL -t

---

From: Roman Czyborra <[email-masked]>
Date: Wed, 9 Feb 1994 22:20:00 +0100

Paul Smith wrote:

> Sorry if this is the nth time you have seen this...

No, it's just arrived for the first time.

> I have two accounts, and I would like to set up a recipe at one site
> that will copy the *headers only* of any mail recieved there and
> send them to the other site in the body of a message.

> :0 ch
> * !$^X-Loop.*: (${OKLIST})
> * ? test "$MEHERE" = "$WUARSRV"
> | formail -A "X-Loop($WHEN.$$): $MEHERE" \
> 		-i "To: [email-masked]" \
>		-i "Subject: auto-note" | $SENDMAIL -oi -t

> I use ':0 ch' to allow the entire message to continue to match other
> recipes, but only pipe the header for this one.

Your flags are perfect, omitting the c would make you lose the message
body.  Now, if you insert a new header on top, the original header
will end up in the message body:

	:0ch
	* !$^X-Loop.*: (${OKLIST})
	* ? test "$MEHERE" = "$WUARSRV"
	| ( echo "To: [email-masked]"; \
	    echo "Subject: auto-note"; \
	    echo "X-Loop($WHEN.$$): $MEHERE"; \
	    echo ""; \
	    sed '1s/^From />From /' ) | $SENDMAIL -oi -t

---

From: [email-masked] (J. Daniel Smith)
Date: Wed, 9 Feb 94 23:41:26 -0500

Roman Czyborra ([email-masked]) writes on  9 February 1994 at 22:20:00 +0100
>[...]
>[...]

   Dan
==== message is author's opinion only -- it is not an official statement ====
J. Daniel Smith                                      Applicon, Inc.
(313) 995-6395, 995-6171 (FAX)                       Ann Arbor, Michigan (USA)
[email-masked] (Internet), AAACA1::DSMITH (SINet)