mail icon indicating copy to clipboard operation
mail copied to clipboard

LF multipart messages are not parsed correctly

Open felipec opened this issue 4 years ago • 1 comments

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.

felipec avatar Apr 16 '21 20:04 felipec

+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.

noaheverett avatar Oct 12 '21 17:10 noaheverett