Empty `HtmlBody` for some Apple Mail messages (sent from iOS)
alex-jitbit opened this issue · 2 comments
Describe the bug
Both HtmlBody
and TextBody
return null for some Apple Mail messages. However the bodies can be retrieved by enumerating BodyParts
manually like this:
body = ((TextPart)msg.BodyParts.FirstOrDefault(b => b is TextPart && b.ContentType.MimeType == "text/html"))?.Text;
- MimeKit Version: 4.2.0
To Reproduce
I've attached an .eml file and cleared out all the sensitive info from it.
Expected behavior
HtmlBody should be set to first BodyPart maybe?
Additional context
I totally understand that the message hierarchy is kinda, uhm, malformed. However maybe you would like to add a workaround b/c this is from iOS 16 Mail app which is becoming popular.
test321.zip
I've taken a look at the message and it appears that the mime structure is as follows:
- multipart/alternative
- multipart/mixed
- text/html
- text/html
- text/html
- multipart/mixed
It's a pretty bizarre structure that I'm not entirely sure how to interpret.
Expected behavior
HtmlBody should be set to first BodyPart maybe?
Maybe? Technically speaking, the entire multipart/mixed is the "body". Each child of a multipart/alternative is supposed to be an option to use as the message body, each being an "alternative" to its siblings. In this case, the multipart/mixed is the only child of the multipart/alternative.
This is fixed now.