def enumerateContentTypes(msg):
    """Enumerate all content types in a parsed email message, including sub messages in multipart messages."""
    result=[]
    result.append(msg.get_content_type())
    if msg.is_multipart():
        for part in msg.get_payload():
            result.extend(enumerateContentTypes(part))
    return result