#here we are trying to find mails in my sent items folder 7 days ago
import sys, win32com.client as client, datetime
# Connect with MS Outlook - must be open.
outlook=client.Dispatch("Outlook.Application")
d = (datetime.date.today() - datetime.timedelta (days=7)).strftime("%d-%m-%y")
print(d)
olFolder = outlook.GetNamespace("MAPI").Folders("allsourav@hotmail.com").Folders("Sent Items")
itmemail = outlook.Createitem(0)
messages = olFolder.Items
for msg in messages:
if(msg.SentOn.strftime("%d-%m-%y")==d):
print (msg.Subject,msg.SentOn.strftime("%d-%m-%y"))
No comments:
Post a Comment