Fix bug
This commit is contained in:
parent
4fb746a1d7
commit
2847ed86f1
|
@ -27,15 +27,16 @@ def process_mailbox(mailbox, to = None):
|
||||||
print("ERROR getting message", num)
|
print("ERROR getting message", num)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
msg = email.message_from_string(data[0][1].decode())
|
msg = email.message_from_bytes(data[0][1])
|
||||||
|
|
||||||
if to is not None:
|
if to is not None:
|
||||||
print('To: ', to)
|
print('To: ', to)
|
||||||
|
|
||||||
print('From:', msg['From'])
|
print('From:', msg['From'])
|
||||||
|
|
||||||
subject = decode_mime_words(msg['Subject'])
|
subject = decode_mime_words(msg['Subject'])
|
||||||
|
|
||||||
print('Subject: %s' % decode_mime_words(msg['Subject']))
|
print('Subject: %s' % subject)
|
||||||
date_tuple = email.utils.parsedate_tz(msg['Date'])
|
date_tuple = email.utils.parsedate_tz(msg['Date'])
|
||||||
if date_tuple:
|
if date_tuple:
|
||||||
local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))
|
local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))
|
||||||
|
|
Loading…
Reference in New Issue