如果可能的话,如何使用 win32com python 库将已发送的电子邮件标记为后续提醒日期,我下面的代码确实发送了电子邮件,但不创建后续提醒。
代码:
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
#attachment1 = "x:\\report.htm"
attachment1 = "c:\\installAgent.log"
mail.Attachments.Add(Source=attachment1)
mail.To = "[email protected]"
mail.Subject = "test"
mail.HtmlBody = '<h2>HTML Message body</h2>' #this field is optional
mail.FlagRequest = "Follow up";
mail.Display(True)
mail.send
您可以通过两种方式设置提醒:
`
from datetime import datetime, timedelta
import win32com.client as win32
# Set the reminder to 7 days from now
reminder_time = datetime.now() + timedelta(days=7)
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.TaskStartDate = reminder_time # flag start date
mail.TaskDueDate = reminder_time # flag due date
mail.FlagDueBy = reminder_time # reminder bell
mail.FlagIcon = 6 # orange flag
mail.FlagStatus = 2
# Save and close the email
mail.Save()
mail.Close(0)
`