<p>I'm working with a snippet of code that recursively calls itself and tries to pull out a MIME Type part of <code>text/html</code> from an email (if it exists) for further processing.</p>

<p>The "text/html" could exist inside other content such as <code>multipart/alternative</code>, so I'm trying to find out if there is a defined hierarchy for email MIME Types.</p>

<p>Anybody know if there is and what it is? i.e. what types can parent other types?</p>

[{'answer_id': 55466, 'author': 'Robby Slaughter', 'author_id': 1854, 'author_profile': 'https://Stackoverflow.com/users/1854', 'pm_score': 0, 'selected': False, 'text': "<p>Your question assumes that mail clients follow the RFC standards for MIME encoding, which they don't. I'd advise you collect a bunch of mail from sources and try and process it as-it-exists. The problem you are facing is extremely difficult (perhaps impossible) to solve 100%.</p>\n"}, {'answer_id': 55528, 'author': 'David Singer', 'author_id': 4618, 'author_profile': 'https://Stackoverflow.com/users/4618', 'pm_score': 2, 'selected': True, 'text': '<p>In theory, only multipart/ and message/ can parent other types (per RFC2046).</p>\n'}]
['https://Stackoverflow.com/questions/55460', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1463/']