Hide e-mail alert segment if there are no unseen e-mails
This commit is contained in:
parent
f8d6f53a24
commit
52a52c8eb6
|
@ -242,7 +242,7 @@ def email_imap_alert(username, password, server='imap.gmail.com', port=993, fold
|
|||
mail = imaplib.IMAP4_SSL(server, port)
|
||||
mail.login(username, password)
|
||||
rc, message = mail.status(folder, "(UNSEEN)")
|
||||
unread_count = re.search("UNSEEN (\d+)", message[0]).group(1)
|
||||
unread_count = int(re.search("UNSEEN (\d+)", message[0]).group(1))
|
||||
except (imaplib.IMAP4.error, AttributeError):
|
||||
return None
|
||||
if not unread_count:
|
||||
|
|
Loading…
Reference in New Issue