I am trying to use Python code to search the mail folders in Outlook for a particular email address.
Here's a snippet of the code :
domainsearch = [message for message in inbox.items if message.senderemailaddress.endswith("russellreynolds.com")]
for message in domainsearch:
print(message)
but this piece of code returns nothing, whereas if I check outlook manually, I do see emails wherein the address does end with the domain name used in the string in the code above.
is there something I am getting wrong?
also I have few additional questions :
- How do I specify a date range so that not only does it not search for a particular email address but also checks for those mails within the given the date range
- Can I pass on wildcard characters while passing on the search string for the domain name?
- While this code is written to search only within the "inbox" folder, how can the search be made to run over all folders within outlook/gmail
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…