summaryrefslogtreecommitdiff
path: root/email-widget/count_unread_emails.py
diff options
context:
space:
mode:
Diffstat (limited to 'email-widget/count_unread_emails.py')
-rw-r--r--email-widget/count_unread_emails.py16
1 files changed, 16 insertions, 0 deletions
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