2017-01-31 03:38:50 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import imaplib
|
2019-02-05 02:10:00 +01:00
|
|
|
import re
|
2017-01-31 03:38:50 +01:00
|
|
|
|
|
|
|
M=imaplib.IMAP4_SSL("mail.teenagemutantninjaturtles.com", 993)
|
|
|
|
M.login("mickey@tmnt.com","cowabunga")
|
|
|
|
|
|
|
|
status, counts = M.status("INBOX","(MESSAGES UNSEEN)")
|
|
|
|
|
|
|
|
if status == "OK":
|
2019-02-05 02:10:00 +01:00
|
|
|
unread = re.search(r'UNSEEN\s(\d+)', counts[0].decode('utf-8')).group(1)
|
2017-01-31 03:38:50 +01:00
|
|
|
else:
|
2019-02-05 02:10:00 +01:00
|
|
|
unread = "N/A"
|
2017-01-31 03:38:50 +01:00
|
|
|
|
2019-02-05 02:10:00 +01:00
|
|
|
print(unread)
|