I came across this to send mails via outlook in python3: Send Outlook email using python win32com and flag as Follow-up
However I get stuck, when I try to use the DateAdd function for mail.FlagDueBy and can not really find a way on how to use it properly.
I tried:
mail.FlagDueBy = win32.DateAdd("d", 3, win32.Date)
and mail.FlagDueBy = DateAdd("d", 3, win32.Date)
Both of them resulting in an error (e.g.)
AttributeError: module 'win32com.client' has no attribute 'DateAdd'
What am I doing wrong? I am using python 3.8.8
Codesample:
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
#attachment1 = "x:\\report.htm"
attachment1 = "c:\\installAgent.log"
mail.Attachments.Add(Source=attachment1)
mail.To = "obama@hotmail.com"
mail.Subject = "test"
mail.HtmlBody = '<h2>HTML Message body</h2>' #this field is optional
mail.FlagRequest = "Follow up";
mail.FlagDueBy = DateAdd("d", 3, Date)
mail.Display(True)