对不起,我的英语不太好: 在windows域中,我尝试使用pypi站点上给出的示例连接到exchangeserver(2010/SP3):
from exchangelib import DELEGATE, NTLM, Account, Credentials, Configuration
import os, logging
logging.basicConfig(level=logging.DEBUG)
creds = Credentials(
username='mydomain\\my.name',
password='mypassword')
config = Configuration(server='exchange.xxx.local/EWS/Exchange.asmx', credentials=creds)
account = Account(
primary_smtp_address='my.name@mycompany.com',
credentials=creds,
autodiscover=False,
access_type=DELEGATE)
for item in account.inbox.all().order_by('-datetime_received')[:30]:
print(item.subject, item.body, item.attachments)
启动脚本后,我在python控制台中得到以下输出:
^{pr2}$我还尝试了exchangelib站点的其他选项,autodiscover=True,只有creds=given(没有config=)。没有成功。 然后,我从https://ewseditor.codeplex.com/安装了EWS编辑器,以查看通过EWS的连接在我公司的环境中是否有效。它可以很好地使用这个工具,只要给它我的SMTP地址。在
我将非常感谢你的帮助。提前谢谢!在
你可能需要告诉exchangelib你的代理。您可以通过环境变量:https://github.com/ecederstrand/exchangelib/issues/123#issuecomment-295648189或自定义HTTPAdapter类:https://github.com/ecederstrand/exchangelib/issues/156#issuecomment-312391095
相关问题 更多 >
编程相关推荐