If you are doing any serious email work, you might find that the enmime module is useful.
https://github.com/jhillyerd/enmime And perhaps this: https://github.com/gatherstars-com/jwz Jim On Wed, Jul 19, 2023 at 9:07 AM Karan Gupta <karan.gupt...@gmail.com> wrote: > That is correct. It is the same issue. > Thanks for the help. > > -Karan > > > On Wed, 19 Jul, 2023, 05:15 Ian Lance Taylor, <i...@golang.org> wrote: > >> On Tue, Jul 18, 2023 at 4:36 PM Karan Gupta <karan.gupt...@gmail.com> >> wrote: >> > >> > RFC 5322 (https://www.rfc-editor.org/rfc/rfc5322#section-3.5) allows >> for messages without bodies. >> > ` A message consists of header fields, optionally followed by a message >> body ` >> > >> > However, the net/mail . ReadMessage returns an error when an email does >> not contain a body. >> > To demonstrate this I have written a small program (attached) that >> shows the difference in values returned by mail.ReadMessage when the input >> email message ends in >> > 1. a 'field' where field is defined as in RFC5322. with focus on the >> fact that 'field' ends in a single CRLF >> > 2. a body. In this specific case, I have chosen to use an empty body. >> Email is constructed by appending 2 consecutive CRLFs to the message from >> (1). The first CRLF is to separate the header from the body and the second >> to terminate an empty body >> > >> > Is this a bug in the go standard library? >> >> I think you are describing https://go.dev/issue/33823, which, as it >> happens, is fixed in the upcoming Go 1.21 release. >> >> Ian >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAAtLhrc4tohZW9taHcyUHr09UN7X5u84XaJS6B_CSr2g-SurVw%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CAAtLhrc4tohZW9taHcyUHr09UN7X5u84XaJS6B_CSr2g-SurVw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGPPfg-QEXMcOVoYvJeZMZ_jN_1CdpVjKv1BeUcSFfxQEjS5tQ%40mail.gmail.com.