import win32com.client
outlook=win32com.clent.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox=outlook.GetDefaultFolder(6)
messages=inbox.Items
message.messages.GetLast()
body_content=message.Body
print(body_content)
这将打印收件箱中的电子邮件正文。我想做的是揭示这段代码的每个阶段都发生了什么,这样我就可以更好地理解它,但是当我试图打印收件箱时,我收到的消息是:
^{pr2}$我该如何揭示这一点,这样我就可以开始了解我在做什么。在
我也在寻找一个地方,如果有人可以分享的话,有一个关于使用python与msoutlook交互的清晰文档的地方。在
我还不能发表评论,但我想补充一下本的回答(在类似的情况下,这对我帮助很大)
我想要一种从Outlook的多个PST文件/帐户中获取电子邮件的方法
有一种模式可以使用
Folders.Count
和Folders.Item(1)
来获取消息。希望这能对某些人有所帮助,因为我花了几个小时在谷歌上搜索到这一点。在在这里试试:
在outlook对象模型中,大多数对象都有一个}。在
Class
属性,它返回一个OlObjectType
类型的枚举,说明它是什么类型的对象。outlook(实际上也是msoffice)对象的其他属性是Parent
和{如果您真的愿意,应该很容易生成一个函数
describe_outlook_object
,该函数返回一个包含有用信息的字符串。当然,你得自己写。在或者,如果您只想探索对象模型,您可以做得比在Outlook中按Alt+F11并使用visualbasic做得更好。(必须启用宏。)
相关问题 更多 >
编程相关推荐