Fix Unicode issues with mail segment

This commit is contained in:
Kim Silkebækken 2013-02-01 22:32:39 +01:00
parent 4cda38e214
commit ea32006715
1 changed files with 1 additions and 1 deletions

View File

@ -242,7 +242,7 @@ def email_imap_alert(username, password, server='imap.gmail.com', port=993, fold
try:
mail = imaplib.IMAP4_SSL(server, port)
mail.login(username, password)
rc, message = mail.status(folder, '(UNSEEN)')
rc, message = mail.status(folder, '(UNSEEN)').decode('utf-8')
unread_count = int(re.search('UNSEEN (\d+)', message[0]).group(1))
except (imaplib.IMAP4.error, AttributeError):
return None