mail-parser icon indicating copy to clipboard operation
mail-parser copied to clipboard

Handle multi part/ alternative text emails?

Open CaptainDriftwood opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I'm having trouble parsing email bodies that are multipart.

Describe the solution you'd like To correctly parse multipart email bodies.

Describe alternatives you've considered Simply falling back to the standard library email parsing functionality.

Additional context Add any other context or screenshots about the feature request here.

CaptainDriftwood avatar Aug 08 '22 15:08 CaptainDriftwood

I have the same issue: it would be very useful to be able to know when a .text_plain item is simply the text version of a .text_html item. Otherwise it is hard to extract, say, a text version of a message (often we have both a plain and an HTML version of it; sometimes there is only the HTML version; in principle there could be some plain text and then some unrelated HTML, if I'm not mistaken; etc.).

Maybe a solution would be to add a .text attribute with the following structure?

[
  (text_plain0, alternative_text_html0),
  (None, unique_text_html1),  # No plain alternative
  (unique_text_plain2, None),  # No HTML alternative
  …
]

lebigot avatar Feb 21 '23 22:02 lebigot