failobj, and when getting the subtype use 'plain' as the failobj.
text/plain is supposed to be the default if the message contains no
Content-Type: header.
omitted, only the main type is matched.
"""
for subpart in msg.walk():
- if subpart.get_main_type() == maintype:
- if subtype is None or subpart.get_subtype() == subtype:
+ if subpart.get_main_type('text') == maintype:
+ if subtype is None or subpart.get_subtype('plain') == subtype:
yield subpart