Skip to content

Conversation

@cosarara
Copy link

Our system sometimes receives emails where the attachments have the wrong mime type. For instance, a PNG attachment might come in with the content-type set to text/plain.
mail-parser helpfully decodes text/plain into valid utf8, which means that non-utf8 byte sequences get replaced by “�” (U+FFFD), destroying the content. Then, there is no way to recover the original contents of the file if later down the line we decide we would like to reinterpret the attachment as non-text.
I have patched the library to add a raw_body next to the body for attachments, which always returns the bytes regardless of PartType, and we are using this as an internal fork for now, but it would be a lot nicer if we can get the feature (in this form or some other way) upstreamed and move back to upstream stalwartlabs/mail-parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant