Subject: [lamps] (off topic) question about Canonical Encoding Model

From: Francesco Gennai <[email-masked]>
Date: Wed, 23 Feb 2022 08:42:09 +0100

Hi All,

I apologize for the off topic question, that is mainly about the canonical
format in a MIME part, but I hope to find an answer from this WG.

I need to add a message/rfc822 part to a multipart/mixed structure.
It is a simple plain/text message.

I know that I must create the canonical form of such a message.
My doubt is about the last line of the message/rfc822 part content:
 should it always end with CRLF? also when the RFC822 message that I'm
enclosing in the MIME message/rfc822 part has not a linebreak at the end of
the last line?
(Of course in any case the CRLF before the boundary is present).

It seems to me that the RFC5322 specification admit email message body that
end without CRLF:

3.5 <https://datatracker.ietf.org/doc/html/rfc5322#section-3.5>.
Overall Message Syntax
.....

   message         =   (fields / obs-fields)
                       [CRLF body]

   body            =   (*(*998text CRLF) *998text) / obs-body

   text            =   %d1-9 /            ; Characters excluding CR
                       %d11 /             ;  and LF
                       %d12 /
                       %d14-127

Suppose that the email that I should insert in the message/rfc822 part end with

...
Regards,
Xyzk

(without linebreak after Xyzk)

So my question is

Could the message/rfc822 MIME part end as follows (no CRLF added after Xyzk)?

...
Regards,
Xyzk
--testboundary

or should I add an extra CRLF after Xyzk, so the message/rfc822 ends as follows?

....
Regards,
Xyzk

--testboundary

In the latter case I have broken the original message that was without
the final linebreak.

Thank you for your attention.

Regards,
Francesco

---

From: Alexey Melnikov <[email-masked]>
Date: Wed, 23 Feb 2022 17:55:29 +0000

Hi Francesco,

On 23/02/2022 07:42, Francesco Gennai wrote:
> Hi All,
>
> I apologize for the off topic question, that is mainly about the 
> canonical format in a MIME part, but I hope to find an answer from 
> this WG.
>
> enclosing in the MIME message/rfc822 part has not a linebreak at the 
> end of the last line?
> It seems to me that the RFC5322 specification admit email message body 
> that end without CRLF:
> Overall Message Syntax ..... message = (fields / obs-fields) [CRLF 
> body] body = (*(*998text CRLF) *998text) / obs-body text = %d1-9 / ; 
> Characters excluding CR %d11 / ; and LF %d12 / %d14-127 Suppose that 
> the email that I should insert in the message/rfc822 part end with... 
> Regards, Xyzk
> Could the message/rfc822 MIME part end as follows (no CRLF added after 
> Xyzk)? ... Regards, Xyzk --testboundary
This is fine. Check BNF syntax for multipart/* in RFC 2046 (Section 
5.1.1). Basically for your example the delimiter is "<CR><LF>--testboundary"
> or should I add an extra CRLF after Xyzk, so the message/rfc822 ends 
> as follows? .... Regards, Xyzk --testboundary
> Regards, Francesco

Best Regards,

Alexey