mail
mail copied to clipboard
LF multipart messages are not parsed correctly
When a message has LF line endings, has multiple parts, and non-ASCII characters it is interpreted as a binary file, therefore the LF endings are not converted to CRLF, and the multipart regex fails to split the parts correctly.
+1 Also seeing this issue with certain emails. I tested the fix in https://github.com/mikel/mail/pull/1437 and it worked for the email that was breaking and not finding the parts (even though it said it was multipart).
Another workaround that's working for us is manually converting line-breaks to CRLF via:
rawemail.encode(universal_newline: true).encode(crlf_newline: true)
First encode normalizes line-breaks and then lastly convert to CRLF.