Skip to content
Advertisement

Parse multipart/related emails

I’m trying to parse emails and convert tables within them into pandas dataframes. Since some of the emails are multipart, I took some code from this answer.

The following code works fine but it breaks with multipart/related emails (no tables are found).

JavaScript

Here’s the header of one of the multipart/related emails:

JavaScript

Any ideas? Thanks

Advertisement

Answer

you want to parse text/html parts

you should check for content type == ‘text/html’

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement