I am trying to fetch emails using imap_tools. I want to limit the fetch to new emails that contain the word "order" in the subject but do not contain any of the words "stock", "return" and "delivery" in the subject.
I thought this line would do it but I get the error below.
ubox = MailBox(yahooSmtpServer).login(email, password, 'INBOX')
msgs = ubox.fetch(AND(new=True, subject='order'), NOT(OR(subject=['stock', 'return', 'delivery'])))
encode() argument 'encoding' must be str, not NOT
Can anyone see where I have gone worng?