diff --git a/eml.go b/eml.go index 2fd413b..7dd3686 100644 --- a/eml.go +++ b/eml.go @@ -6,6 +6,7 @@ package mail import ( "bytes" + "encoding/base64" "errors" "fmt" "mime" @@ -151,6 +152,16 @@ func parseEMLBodyParts(pm *nm.Message, mbbuf *bytes.Buffer, m *Msg) error { m.SetBodyString(TypeTextPlain, qpbuf.String()) break } + if cte == EncodingB64.String() { + m.SetEncoding(EncodingB64) + b64d := base64.NewDecoder(base64.StdEncoding, mbbuf) + b64buf := bytes.Buffer{} + if _, err := b64buf.ReadFrom(b64d); err != nil { + return fmt.Errorf("failed to read base64 body: %w", err) + } + m.SetBodyString(TypeTextPlain, b64buf.String()) + break + } default: } return nil