如何在python中读取数字签名电子邮件

时间:2019-05-06 11:04:13

标签: python outlook automation win32com

我的目标是将邮件从特定的人转移到Outlook中的其他文件夹。这可以使用“规则”选项来实现,但是我想根据需要运行脚本以定期移动电子邮件。我正在为此活动使用python。当我尝试查找发件人姓名时,出现错误消息,例如“此邮件已经过数字签名,无法在uiless模式下打开”

下面是我的代码。python3.7

import win32com.client
outlook=win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox=outlook.GetDefaultFolder(6)
messages=inbox.Items
message=messages.GetLast()
while message:
        print(repr(message.SenderemailAddress))
        message=messages.GetPrevious()

错误:pywintypes.com_error:(-2147352567,“发生异常。”,(4096,“ Microsoft Office Outlook”,“此经过数字签名的电子邮件有回执请求,因此无法在没有UI的模式下打开。',无,0,-2147217663),无)

0 个答案:

没有答案