From 7bab821f2080e2f8d8a6285e57824dc738e1e781 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 4 Feb 2019 20:10:00 -0500 Subject: fix email widget script --- email-widget/count_unread_emails.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'email-widget') diff --git a/email-widget/count_unread_emails.py b/email-widget/count_unread_emails.py index f4d2b86..a843814 100644 --- a/email-widget/count_unread_emails.py +++ b/email-widget/count_unread_emails.py @@ -1,7 +1,7 @@ #!/usr/bin/python import imaplib -import email +import re M=imaplib.IMAP4_SSL("mail.teenagemutantninjaturtles.com", 993) M.login("mickey@tmnt.com","cowabunga") @@ -9,8 +9,8 @@ M.login("mickey@tmnt.com","cowabunga") status, counts = M.status("INBOX","(MESSAGES UNSEEN)") if status == "OK": - unread = counts[0].split()[4][:-1] + unread = re.search(r'UNSEEN\s(\d+)', counts[0].decode('utf-8')).group(1) else: - unread = "N/A" + unread = "N/A" -print(unread) \ No newline at end of file +print(unread) -- cgit v1.2.3