mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Add handling for multipart/alternative content type
The EML parser now includes logic to manage 'multipart/alternative' content types. This adjustment is made within the section handling 'multipart/related' parts, allowing for better handling and parsing of varying content types.
This commit is contained in:
parent
84e6275cb2
commit
fcc5209852
1 changed files with 3 additions and 1 deletions
4
eml.go
4
eml.go
|
@ -256,7 +256,9 @@ ReadNextPart:
|
||||||
// Multipart/related parts need to be parsed seperately
|
// Multipart/related parts need to be parsed seperately
|
||||||
if contentTypeSlice, ok := multiPart.Header[HeaderContentType.String()]; ok && len(contentTypeSlice) == 1 {
|
if contentTypeSlice, ok := multiPart.Header[HeaderContentType.String()]; ok && len(contentTypeSlice) == 1 {
|
||||||
contentType, _ := parseMultiPartHeader(contentTypeSlice[0])
|
contentType, _ := parseMultiPartHeader(contentTypeSlice[0])
|
||||||
if strings.EqualFold(contentType, TypeMultipartRelated.String()) {
|
fmt.Printf("CONTENT-TYPE: %s\n", contentType)
|
||||||
|
if strings.EqualFold(contentType, TypeMultipartRelated.String()) ||
|
||||||
|
strings.EqualFold(contentType, TypeMultipartAlternative.String()) {
|
||||||
relatedPart := &netmail.Message{
|
relatedPart := &netmail.Message{
|
||||||
Header: netmail.Header(multiPart.Header),
|
Header: netmail.Header(multiPart.Header),
|
||||||
Body: multiPart,
|
Body: multiPart,
|
||||||
|
|
Loading…
Reference in a new issue