mirror of
https://github.com/GRFreire/nthmail.git
synced 2026-01-09 04:49:39 +00:00
fix plain txt mails not parsing the mail body
the problem was that it was declared a byte array (txt) with essentially size 0 and calling Read(txt). Since Read reads n bytes up to sizeof(txt), nothing was being read.
This commit is contained in:
parent
269c7614e1
commit
444e3d877e
@ -94,15 +94,14 @@ func Parse_mail(m_data []byte, header_only bool) (Mail_obj, error) {
|
||||
}
|
||||
|
||||
if content_type == "" || !strings.HasPrefix(mediaType, "multipart/") {
|
||||
var txt []byte
|
||||
_, err := mail_msg.Body.Read(txt)
|
||||
txt_bytes, err := io.ReadAll(mail_msg.Body)
|
||||
if err != nil {
|
||||
return m, err
|
||||
}
|
||||
|
||||
var body Mail_body
|
||||
body.MimeType = PlainText
|
||||
body.Data = string(txt)
|
||||
body.Data = string(txt_bytes)
|
||||
|
||||
m.MediaType = NotMultipart
|
||||
m.Body = append(m.Body, body)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user