diff --git a/awesome-wm-widgets/email-widget/read_unread_emails.py b/awesome-wm-widgets/email-widget/read_unread_emails.py index b91ebde..1304cf2 100755 --- a/awesome-wm-widgets/email-widget/read_unread_emails.py +++ b/awesome-wm-widgets/email-widget/read_unread_emails.py @@ -27,15 +27,16 @@ def process_mailbox(mailbox, to = None): print("ERROR getting message", num) return False - msg = email.message_from_string(data[0][1].decode()) + msg = email.message_from_bytes(data[0][1]) if to is not None: print('To: ', to) print('From:', msg['From']) + 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']) if date_tuple: local_date = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))