python如何读取weboutlook内容_用Python通过MAPI读取Outlook中的电子邮件
我正在嘗試編寫一個簡短的程序,該程序將讀取exchange/Outlook配置文件中某個文件夾中電子郵件的內容,以便可以操作數據。但是,我在查找有關python和exchange/Outlook集成的許多信息時遇到問題。很多東西不是很舊/沒有文檔/沒有解釋。我試過幾個片段,但似乎也有同樣的錯誤。我試過Tim Golden的密碼:import win32com.client
session = win32com.client.gencache.EnsureDispatch ("MAPI.Session")
#
# Leave blank to be prompted for a session, or use
# your own profile name if not "Outlook". It is also
# possible to pull the default profile from the registry.
#
session.Logon ("Outlook")
messages = session.Inbox.Messages
#
# Although the inbox_messages collection can be accessed
# via getitem-style calls (inbox_messages[1] etc.) this
# is the recommended approach from Microsoft since the
# Inbox can mutate while you're iterating.
#
message = messages.GetFirst ()
while message:
print message.Subject
message = messages.GetNext ()
但是我得到一個錯誤:pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
不確定我的個人資料名稱,所以我嘗試了:session.Logon()
提示,但也不起作用(同樣的錯誤)。同時嘗試打開和關閉Outlook,但都沒有改變任何內容。
總結
以上是生活随笔為你收集整理的python如何读取weboutlook内容_用Python通过MAPI读取Outlook中的电子邮件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: clickhouse 新增列_# 记录一
- 下一篇: android APK 查看程序MD5