I am trying to use imap_tools to fetch new emails. For some reason it only seems to fetch emails that were already in my inbox when I log in.
Can anyone see what I am doing wrong?
mailbox.login(email, password, initial_folder='INBOX')
print("Logging in")
for _ in range(50):
try:
msgs = mailbox.fetch(AND(new=True, subject='Order'))
print("Fetching emails")
for msg in msgs:
mail = msg.subject
print(mail)
except:
pass
sleep(1)
mailbox.logout()
print("Logging out")