我正在尝试创建一个脚本,以将每天早上 8:00 开始的所有 Outlook 已发送项目转发到专用收件箱。
邮件必须保存在 Outlook 的已发送邮件文件夹中。
目前我有今天的所有电子邮件,但脚本的前向部分不起作用(我没有任何错误消息)
编辑 1:感谢 Jimmy 的限制想法!
import win32com.client as win32
outlook = win32.Dispatch("Outlook.Application").GetNamespace("MAPI")
outbox = outlook.GetDefaultFolder(6)
messages = messages = outbox.Items.restrict("[SentOn] > '5/31/2017 08:00 AM'")
for message in messages:
NewMsg = message.Forward()
NewMsg.To = "mail@mail.com"
最佳答案
已完成:有兴趣的可以在下面找到解决方案
import win32com.client as win32
outlook = win32.Dispatch("Outlook.Application").GetNamespace("MAPI")
outbox = outlook.GetDefaultFolder(5)
messages = outbox.Items.restrict("[SentOn] > '5/30/2017 08:00 AM'")
for message in messages:
NewMsg = message.Forward()
NewMsg.Body = message.Body
NewMsg.Subject = message.Subject
NewMsg.To = "mail@mail.com"
NewMsg.Send()
关于python-2.7 - Python - Win32Com - Outlook - 将今天发送的项目转发到收件箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44266495/