使用exchangelib读取收件箱的子文件夹

时间:2018-06-19 08:36:09

标签: python exchangelib

是否可以使用exchangelib读取收件箱子文件夹中的电子邮件正文?如果是,我该如何实现? 我只知道我可以使用以下代码获取收件箱中的电子邮件正文:

for item in account.inbox.all().order_by('-datetime_received')[:1]:
    print(item.body)

1 个答案:

答案 0 :(得分:1)

Yes, that's possible. See the folder navigation options described in https://github.com/ecederstrand/exchangelib#folders

Here's an example:

sub_sub_folder = account.inbox / 'Some' / 'Subfolder'
for item in sub_sub_folder.all().order_by('-datetime_received')[:1]:
    print(item.body)