def get_message_date(content, header='Date'):
 message = MailParser().parsestr(content, True)
 dateheader = message.get(header)
 datetuple = email.utils.parsedate_tz(dateheader)
 if (datetuple is None):
  return None
 return email.utils.mktime_tz(datetuple)

def get_message_date ( content , header = 'Date' ) : message = MailParser ( ) . parsestr ( content , True ) dateheader = message . get ( header ) datetuple = email . utils . parsedate_tz ( dateheader ) if ( datetuple is None ) : return None return email . utils . mktime_tz ( datetuple )
parses mail and returns resulting timestamp .