Created
September 18, 2012 04:06
-
-
Save mrtazz/3741193 to your computer and use it in GitHub Desktop.
Revisions
-
mrtazz created this gist
Sep 18, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/usr/bin/env python """ small script to check for unread count on imap inbox """ import imaplib IMAPSERVER = '' USER = '' PASSWORD = '' try: mail = imaplib.IMAP4_SSL(IMAPSERVER) mail.login(USER, PASSWORD) mail.select("inbox", True) # connect to inbox. return_code, mail_ids = mail.search(None, 'UnSeen') count = len(mail_ids[0].split(" ")) except: count = 0 print count