fix timestamp issues
This commit is contained in:
parent
f9624f81e9
commit
cfacb77777
|
@ -4,7 +4,6 @@ import hashlib
|
|||
import imaplib
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
from email.header import decode_header
|
||||
from email.utils import parsedate_to_datetime
|
||||
from json import JSONEncoder
|
||||
|
@ -69,9 +68,9 @@ class MailConnection:
|
|||
email_message = email.message_from_string(raw_email)
|
||||
date_header = email_message['Date']
|
||||
if not date_header:
|
||||
date_header = 0
|
||||
date = parsedate_to_datetime(date_header)
|
||||
unix_timestamp = int(time.mktime(date.timetuple()))
|
||||
date_header = 'Thu, 1 Jan 1970 00:00:00 +0000'
|
||||
parsed_date = email.utils.parsedate_to_datetime(date_header)
|
||||
unix_timestamp = int(parsed_date.timestamp())
|
||||
|
||||
from_addr = email_message['From']
|
||||
to_addr = email_message['To']
|
||||
|
|
Loading…
Reference in New Issue