From 3a024a7c448cf773889795c2c34ba45dcef48acc Mon Sep 17 00:00:00 2001 From: Rodrigo Botelho Date: Mon, 12 Dec 2022 11:49:07 -0300 Subject: [PATCH] Feat: Handle nested multipart/mixed --- parsemail.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/parsemail.go b/parsemail.go index 3ea7495..de09ac4 100644 --- a/parsemail.go +++ b/parsemail.go @@ -271,6 +271,19 @@ func parseMultipartMixed(msg io.Reader, boundary string) (textBody, htmlBody str } htmlBody += strings.TrimSuffix(string(ppContent[:]), "\n") + } else if contentType == contentTypeMultipartMixed { + textBody2, htmlBody2, attachments2, embeddedFiles2, err := parseMultipartMixed(part, params["boundary"]) + if err != nil { + return textBody, htmlBody, attachments, embeddedFiles, err + } + textBody += textBody2 + htmlBody += htmlBody2 + if attachments2 != nil { + attachments = append(attachments, attachments2...) + } + if embeddedFiles2 != nil { + embeddedFiles = append(embeddedFiles, embeddedFiles2...) + } } else if isAttachment(part) { at, err := decodeAttachment(part) if err != nil {