如何使用python imaplib访问共享文件夹?

时间:2017-03-29 15:23:50

标签: python-3.x

如何访问共享文件夹?这是一个共享文件夹,也可供其他用户看到。我目前正在使用Outlook,其中共享文件夹与我的个人电子邮件一起可见

2 个答案:

答案 0 :(得分:2)

回到我的问题。读完之后,这似乎有效。

使用imaplib并连接到python 3中的交换

使用此,

result, data=mail.login('personal@domain.com\shared@domain.com','personalPassword')

如果您可以访问Outlook中的此共享邮箱,则可以使用此连接进行连接。打印结果,如果它说'确定'然后代码确实有效。

答案 1 :(得分:0)

我相信这是一个答案。

在此处发布链接,供那些正在使用python解决方案解决类似问题的人使用。

https://medium.com/@theamazingexposure/accessing-shared-mailbox-using-exchangelib-python-f020e71a96ab

以下是代码段:

from exchangelib import Credentials, Account

credentials = Credentials('Firstname.Lastname@someenterprise.com', 'Your_Password_Here')
account = Account('**shared_mail_box_name@someenterprise.com**', credentials=credentials, autodiscover=True)

for item in account.inbox.all().order_by('-datetime_received')[:100]:
    print(item.subject, item.sender, item.datetime_received)
相关问题