python imaplib search with multiple criteria -
i'm trying use search function , running issue. can download attachments gmail account , sort them according file extension. have of code working right except when add criteria search. search criteria unseen emails, works , flags email seen , moves trash. decided add it. here example: original:
resp, items = m.search (none, 'unseen')
new:
resp, items = m.search (none, '(from "email" subject "some text")', 'unseen')
it results emails moved trash, still unread , none of attachments downloaded. have idea may doing wrong here? thanks.
to build on jithps comment right syntax this:
result, data = mail.search(none,'(from "email" subject "the subject" unseen)')
the clauses passed capital letters , criteria within quotes.
Comments
Post a Comment