A very simple email checker (works with imap accounts). Run it by setting it in your crontab to run hourly or something.

A very simple email checker (works with imap accounts). Run it by setting it in your crontab to run hourly or something.

passwords are bz2-encrypted (not very good security, but better than nothing. Anyway debian machines are highly secured ). Place the string generated by bz2.compress("password") instead of "encryptedpassword" below.

#!/usr/bin/pythonimport imaplib, pynotify, bz2check1 = Falsecheck2=Falsei1=imaplib.IMAP4_SSL("imap.myserver.net")i1.login("me@myserver.net",bz2.decompress("encryptedpassword1"))s1 = i1.status("INBOX","(UNSEEN)")n1 = s1[1][0].split()[-1].split(")")[0]i2=imaplib.IMAP4_SSL("imap.gmail.com")i2.login("me@gmail.com",bz2.decompress("encryptedpassword2"))s2 = i2.status("INBOX","(UNSEEN)")n2 = s2[1][0].split()[-1].split(")")[0]if (n1 != "0") or (n2 != "0"):    pynotify.init("mail")    t = "Unread mail"    m = ""    if n1 != "0":        m += n1 + " messages on myserver/n" # change with a backslash    if n2 != "0":
        m += n2 + " messages on gmail/n" # change with a backslash    n=pynotify.Notification(t,m)    n.show()