Created
October 1, 2020 09:25
-
-
Save marcusscomputer/c74e325fc9334ccaba18ef0e9398f347 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env python | |
""" | |
small script to check for unread count on imap inbox | |
""" | |
import imaplib | |
IMAPSERVER = 'YOUR.IMAP-SERVER.COM' | |
USER = 'EMAIL@NUTZERNAME' | |
PASSWORD = 'ACCOUNT-PASSWORT' | |
mail = imaplib.IMAP4_SSL(IMAPSERVER) | |
mail.login(USER, PASSWORD) | |
mail.select("INBOX", True) # connect to inbox. | |
return_code, mail_ids = mail.search(None, 'UnSeen') | |
if mail_ids[0] == "": | |
count1 = 0; | |
else: | |
count1 = len(mail_ids[0].split(" ")) | |
USER = 'ZWEITER-EMAIL@NUTZERNAME' | |
PASSWORD = 'ZWEITES-ACCOUNT-PASSWORT' | |
mail = imaplib.IMAP4_SSL(IMAPSERVER) | |
mail.login(USER, PASSWORD) | |
mail.select("INBOX", True) # connect to inbox. | |
return_code, mail_ids = mail.search(None, 'UnSeen') | |
if mail_ids[0] == "": | |
count2 = 0; | |
else: | |
count2 = len(mail_ids[0].split(" ")) | |
unread = count1 + count2 | |
print unread |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment