Hello,
I'm fairly new to python and still learning. I wrote what I thought was a simple script trying to query my email server for NEW eamil. My problem is, the code runs without any error's.
Logs into server just fine but it never returns resulting in NEW mail even when there is in fact NEW mail on the server. What am I missing to have it return a value for NEW mail? Using Python 3.7 on Windows 10.
Any help would be greatly appreciated. Thanks in advance!
I'm fairly new to python and still learning. I wrote what I thought was a simple script trying to query my email server for NEW eamil. My problem is, the code runs without any error's.
Logs into server just fine but it never returns resulting in NEW mail even when there is in fact NEW mail on the server. What am I missing to have it return a value for NEW mail? Using Python 3.7 on Windows 10.
Any help would be greatly appreciated. Thanks in advance!
import imaplib from os import * import subprocess email_server = "mail.mymail.net" # mymail = imap.mymail.net user = "[email protected]" password = "passwd" notification_title = "New Mail" server = imaplib.IMAP4_SSL(email_server) server.login(user, password) server.select("INBOX") x, items = server.search(None, "UNSEEN") count = 0 for num in items[0].split(): server.status(num, '(RFC822)') count += 1 if count > 0: subprocess.Popen("schtasks.exe /run /tn 'MailReport'")