我想获取非收件箱文件夹的邮件 - 我该怎么做?
我可以像这样获取收件箱文件夹的电子邮件:
from exchangelib import DELEGATE, Account, Credentials, EWSDateTime
creds = Credentials(
username='xxx.test.com\test',
password='123456')
account = Account(
primary_smtp_address='test@test.com',
credentials=creds,
autodiscover=True,
access_type=DELEGATE)
# Print first 100 inbox messages in reverse order
for item in account.inbox.all().order_by('-datetime_received')[:100]:
# print(item.subject, item.body, item.attachments)
print(item.subject)
给予:
hahaha
heiheihei
pupupu
bibibib
........
当我得到我的文件夹时:
from exchangelib.folders import Messages
for f in account.folders[Messages]:
print f
Messages (aaa)
Messages (bbb)
Messages (ccc)
如何ccc
使用 Python 从文件夹中取出电子邮件?