Re: e-mail with line in body beginning with "From"

2022-12-11 Thread David Wright
Threaded to the OP, rather than a private message.

On Sun 11 Dec 2022 at 18:56:24 (-0600), Greg Marks wrote:
> Dear David,

Thanks, but please keep replies on list so others can see
solutions or join in with suggestions.

Rather than appending a piece of free-standing text to the
rest of the email, in mutt you could attach it as a file:

 At the Compose Menu where you type y to send, press a and
 then give the filename.

 Highlight the attachment in the list, and press Ctrl-E.

 Change the encoding from whatever it says, like 7-bit, to
 base64, and press Return.

It now doesn't matter what was in the free-standing test:
it will arrive intact. Even though encoded, the receiver's
mutt will typically display the text attachment straight after
the email text without needing any extra commands, but it can
also be saved like any other attachment.

I've attached a mutt documentation sample file as an example.
Its entry in mutt's Compose Menu looks like:

  A 2 sample.mailcap[text/plain, base64, us-ascii, 0.1K]

 displays after email because  I set this

Note that when sending attachments, the filename may appear
incomplete as it has to include the full path. The receiver
doesn't see the path at their end, but only the filename.

Cheers,
David.
# $Id$

text/html; netscape -remote openURL\(%s\)
image/gif; xv %s
image/jpg; xv %s
application/pgp-keys; pgp -f < %s ; copiousoutput


Re: e-mail with line in body beginning with "From"

2022-12-10 Thread David Wright
On Sat 10 Dec 2022 at 20:45:37 (-0500), pa...@quillandmouse.com wrote:
> On Sun, 11 Dec 2022 09:49:54 +1100
> David  wrote:
> 
> > On Sat, 10 Dec 2022 at 19:05,  wrote:
> > > On Fri, 9 Dec 2022 20:39:34 -0600 Greg Marks 
> > > wrote:
> 
> [snip]
>  
> > 
> > > I don't know the RFCs involved, but I'm guessing they mandate or
> > > suggest this treatment.
> > 
> > Here's a reference describing 'mbox' format, which provides
> > reference RFCs:
> >   https://manpages.debian.org/bullseye/mutt/mbox.5.en.html
> > 
> 
> Excellent reference. Just the thing.

I'm guessing it's useful when

. everyone is using systems that agree to do that type of escaping,
  so that it's safe to undo it, even to many levels,

. the messages are for humans to read, and they can judge from the
  context whether the content has become mangled at all (which is
  why I enquired of the OP whether the precise format is important
  to the recipient).

But now that there are fail-safe methods of encoding "From ", there
doesn't seem much point after two decades in treating this part of
the document as much more than historical.

As for the RFCs cited within, *822 are both concerned only with From:
headers, not what are termed From_ postmarks. And, without an
excessively careful reading of 976 (hardly justified by its 3½ decade
age), the escaping of From is only discussed in the context of
message envelopes, without any consideration of what's contained
within the message.

Note that mbox(5) says "A /variant/ of this format was documented in
RFC976" (my emphasis), and 976 starts by saying "It does not address
the format for storage of messages on one machine".

Cheers,
David.


Re: e-mail with line in body beginning with "From"

2022-12-10 Thread paulf
On Sun, 11 Dec 2022 09:49:54 +1100
David  wrote:

> On Sat, 10 Dec 2022 at 19:05,  wrote:
> > On Fri, 9 Dec 2022 20:39:34 -0600 Greg Marks 
> > wrote:

[snip]
 
> 
> > I don't know the RFCs involved, but I'm guessing they mandate or
> > suggest this treatment.
> 
> Here's a reference describing 'mbox' format, which provides
> reference RFCs:
>   https://manpages.debian.org/bullseye/mutt/mbox.5.en.html
> 

Excellent reference. Just the thing.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread David
On Sat, 10 Dec 2022 at 19:05,  wrote:
> On Fri, 9 Dec 2022 20:39:34 -0600 Greg Marks  wrote:

> > In a recent instance, the body of the e-mail contained a line
> > beginning with the word "From"; the sendmail program prefixed the
> > line with the character ">" and a space (evidently interpreting
> > "From" as a header line that needed to be quoted).  This was more
> > than just a trivial annoyance, since it rendered my digital signature
> > on the e-mail invalid.

> > Is there a way to tell the Postfix sendmail command not to alter any
> > such lines in the body of the message?  (I'm afraid I wasn't able to
> > discern an answer in the man page for sendmail or by searching the
> > postfix.org site.)

> You don't want to do this. Consider an MUA which stores your mail in
> "mbox" format-- one email right after another in one file. The
> delimiter is a line which starts at the left margin with the word
> "From". For this to work, any other line which starts with "From" must
> be "armored". And the way you do that is to precede it with "> ".

> I don't know the RFCs involved, but I'm guessing they mandate or
> suggest this treatment.

Here's a reference describing 'mbox' format, which provides
reference RFCs:
  https://manpages.debian.org/bullseye/mutt/mbox.5.en.html



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread David Wright
On Sat 10 Dec 2022 at 08:24:05 (+0200), Teemu Likonen wrote:
> * 2022-12-09 20:39:34-0600, Greg Marks wrote:
> > 
> > I occasionally send e-mail from the command line via Postfix, using a
> > script containing the command
> > 
> >/usr/sbin/sendmail -oi -f  -t  < file

> > Is there a way to tell the Postfix sendmail command not to alter any
> > such lines ["From" lines] in the body of the message?

Not knowing what prompts these occasions, it difficult to advise.
If the precise format is unimportant, then passing  through
a filter to eleminate any occurrences would be one method: it
could be the first step in a script that calls whatever method
you're using to sign the email.

If format precision matters, see the next quoted paragraph.

As was pointed out, it's only "From " at the start that matters.

> Probably Mutt email client can automatically do all the encoding and
> pass the fully compliant message to sendmail. Mutt can be used in
> command line. I didn't test it because I don't have any sendmails
> installed. A lower level option for constructing valid emails is
> "mime-construct".

From this line, you should get confirmation of mutt's behaviour.
But note that you have to turn it on with
  set encode_from
in its muttrc.

> From letters are in the beginning of this line because I want to test my
> own message and email client: the file that is saved locally in my
> computer and the file which comes through the mailing list.

FWIW your client appears to encode the space,
whereas mutt encodes the F.

And mutt is cautious, as it ought to be, and encodes whether or not the
From follows a blank line.

Cheers,
David.



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread Miguel A. Vallejo
I remember some e-mail programs automatically add an extra space in
front of a From in the message body if any line starts with From.
Probably Thunderbird is one of them.

to...@tuxteam.de wrote:
>
> On Sat, Dec 10, 2022 at 08:36:39AM -0500, Greg Wooledge wrote:
>
> [...]
>
> > Technically, it's the 5-character sequence "From " (including the space)
> > that matters in mbox formats.  If you begin a line with "Fromage" [...]
>
> I thusly propose to drop the '>' escaping of "From" and change every From
> at a line start to "Fromage".
>
> Hmmm. Now I'm hungry.
>
> (Thanks for the laugh :-)
>
> Cheers
> --
> t



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread debian-user
> On Sat, Dec 10, 2022 at 02:57:42AM -0500, pa...@quillandmouse.com
> wrote:
> > You don't want to do this. Consider an MUA which stores your mail in
> > "mbox" format-- one email right after another in one file. The
> > delimiter is a line which starts at the left margin with the word
> > "From".  
> 
> Technically, it's the 5-character sequence "From " (including the
> space) that matters in mbox formats.  If you begin a line with
> "Fromage", or "From:", or even "From" followed by a tab, it won't
> need to be escaped/armored.

There also has to be a blank line before it (unless it's the first five
letters in a mailbox) so effectively it has to be the start of a
paragraph that starts with 'From'. (and then has a particular address
format after it. :)



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread tomas
On Sat, Dec 10, 2022 at 08:36:39AM -0500, Greg Wooledge wrote:

[...]

> Technically, it's the 5-character sequence "From " (including the space)
> that matters in mbox formats.  If you begin a line with "Fromage" [...]

I thusly propose to drop the '>' escaping of "From" and change every From
at a line start to "Fromage".

Hmmm. Now I'm hungry.

(Thanks for the laugh :-)

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: e-mail with line in body beginning with "From"

2022-12-10 Thread Greg Wooledge
On Sat, Dec 10, 2022 at 02:57:42AM -0500, pa...@quillandmouse.com wrote:
> You don't want to do this. Consider an MUA which stores your mail in
> "mbox" format-- one email right after another in one file. The
> delimiter is a line which starts at the left margin with the word
> "From".

Technically, it's the 5-character sequence "From " (including the space)
that matters in mbox formats.  If you begin a line with "Fromage", or
"From:", or even "From" followed by a tab, it won't need to be
escaped/armored.



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread Thomas Schmitt
Hi,

pa...@quillandmouse.com wrote:
> [...] any other line which starts with "From" must
> be "armored". And the way you do that is to precede it with "> ".
> I don't know the RFCs involved, but I'm guessing they mandate or
> suggest this treatment.

It does not look like being fully specified by an RFC.

RFC 4155 "The application/mbox Media Type" mentions

  Many implementations are also known to escape message body lines that
  begin with the character sequence of "From "

and points to
  http://qmail.org/man/man5/mbox.html
where ">From quoting" is described in more detail.
Debian's man 5 mbox stems from package mutt and describes quoting schemes
"MBOXO", "MBOXRD", "MBOXCL".

RFC 4155 decries the situation but then says

  Also note that this specification does not prescribe any escape
  syntax for message body lines that begin with the character sequence
  of "From ".


Have a nice day :)

Thomas



Re: e-mail with line in body beginning with "From"

2022-12-10 Thread paulf
On Fri, 9 Dec 2022 20:39:34 -0600
Greg Marks  wrote:

> I occasionally send e-mail from the command line via Postfix, using a
> script containing the command
> 
>/usr/sbin/sendmail -oi -f  -t  < file
> 
> In a recent instance, the body of the e-mail contained a line
> beginning with the word "From"; the sendmail program prefixed the
> line with the character ">" and a space (evidently interpreting
> "From" as a header line that needed to be quoted).  This was more
> than just a trivial annoyance, since it rendered my digital signature
> on the e-mail invalid.
> 
> I think I encountered a similar problem a couple decades ago using the
> "mail" command on a FreeBSD machine, but I don't remember any solution
> to the problem.
> 
> Is there a way to tell the Postfix sendmail command not to alter any
> such lines in the body of the message?  (I'm afraid I wasn't able to
> discern an answer in the man page for sendmail or by searching the
> postfix.org site.)
> 
> Best regards,
> Greg Marks

You don't want to do this. Consider an MUA which stores your mail in
"mbox" format-- one email right after another in one file. The
delimiter is a line which starts at the left margin with the word
"From". For this to work, any other line which starts with "From" must
be "armored". And the way you do that is to precede it with "> ".

I don't know the RFCs involved, but I'm guessing they mandate or
suggest this treatment.

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



Re: e-mail with line in body beginning with "From"

2022-12-09 Thread Teemu Likonen
* 2022-12-09 20:39:34-0600, Greg Marks wrote:

> Is there a way to tell the Postfix sendmail command not to alter any
> such lines ["From" lines] in the body of the message?

I can't answer your actual question but I think Postfix and other
"sendmails" do the right thing. In my opinion you shouldn't change them
do the wrong thing but fix the problem elsewhere.

Prepare your message in such way that it is encoded in quoted printable
or base64 so that there is no plain "From" in the beginning of any line
in the body. Letters in "From" don't need encoding in quoted printable
but email clients may still encode it because they know what sendmail
programs do.

Probably Mutt email client can automatically do all the encoding and
pass the fully compliant message to sendmail. Mutt can be used in
command line. I didn't test it because I don't have any sendmails
installed. A lower level option for constructing valid emails is
"mime-construct".

From letters are in the beginning of this line because I want to test my
own message and email client: the file that is saved locally in my
computer and the file which comes through the mailing list.

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462


signature.asc
Description: PGP signature


e-mail with line in body beginning with "From"

2022-12-09 Thread Greg Marks
I occasionally send e-mail from the command line via Postfix, using a
script containing the command

   /usr/sbin/sendmail -oi -f  -t  < file

In a recent instance, the body of the e-mail contained a line beginning
with the word "From"; the sendmail program prefixed the line with the
character ">" and a space (evidently interpreting "From" as a header line
that needed to be quoted).  This was more than just a trivial annoyance,
since it rendered my digital signature on the e-mail invalid.

I think I encountered a similar problem a couple decades ago using the
"mail" command on a FreeBSD machine, but I don't remember any solution
to the problem.

Is there a way to tell the Postfix sendmail command not to alter any
such lines in the body of the message?  (I'm afraid I wasn't able to
discern an answer in the man page for sendmail or by searching the
postfix.org site.)

Best regards,
Greg Marks


signature.asc
Description: PGP signature