From c4826fd21340d34e3592b0c8ca24fc068e52c6ef Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 30 Jan 2017 21:38:50 -0500 Subject: new widgets added --- email-widget/count_unread_emails.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 email-widget/count_unread_emails.py (limited to 'email-widget/count_unread_emails.py') diff --git a/email-widget/count_unread_emails.py b/email-widget/count_unread_emails.py new file mode 100644 index 0000000..f4d2b86 --- /dev/null +++ b/email-widget/count_unread_emails.py @@ -0,0 +1,16 @@ +#!/usr/bin/python + +import imaplib +import email + +M=imaplib.IMAP4_SSL("mail.teenagemutantninjaturtles.com", 993) +M.login("mickey@tmnt.com","cowabunga") + +status, counts = M.status("INBOX","(MESSAGES UNSEEN)") + +if status == "OK": + unread = counts[0].split()[4][:-1] +else: + unread = "N/A" + +print(unread) \ No newline at end of file -- cgit v1.2.3