我想检查一下如何用python阅读outlook中的所有电子邮件
我使用下面的代码,但是这个代码只读取第一封邮件
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case,
# the inbox. You can change that number to reference
# any other folder
messages = inbox.Items
message = messages.GetLast()
body_content = message.Body
subject = message.Subject
categories = message.Categories
print(body_content)
print(subject)
print(categories)
我试图找到一种方法,让我们可以阅读所有的电子邮件,但无法得到一个解决方案,是谁知道我们可以阅读所有电子邮件和存储在数据库。在
您可以遍历messages对象以获取所有电子邮件内容。在
相关问题 更多 >
编程相关推荐