I want to get mail for non-inbox folders - how can I do this?
I can get the inbox folder's emails like so:
from exchangelib import DELEGATE, Account, Credentials, EWSDateTime
creds = Credentials(
username='xxx.test.com\test',
password='123456')
account = Account(
primary_smtp_address='[email protected]',
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)
Giving:
hahaha
heiheihei
pupupu
bibibib
........
And when I get my folders:
from exchangelib.folders import Messages
for f in account.folders[Messages]:
print f
Messages (aaa)
Messages (bbb)
Messages (ccc)
How can I get the emails out of the ccc
folder using Python?