#!/usr/bin/env python # coding: utf-8 import email from email.MIMEMultipart import MIMEMultipart if __name__ == "__main__": fp = open("./orig.eml", 'rb') # Create a text/plain message print 'PARSER INVALID EMAIL' msg = email.message_from_file(fp) if msg.is_multipart(): # walk thought the multipart, and check for defects .. for m in msg._payload: if len(m.defects) > 0: print "defects found !" print m.defects fp.close()