我正在尝试为 Office365 配置 python exchangelib,但不知何故它不起作用,不确定是因为公司防火墙还是配置错误。
我已经尝试了 40 多个配置,有和没有自动发现链接。
我正在尝试连接到组邮箱而不是私人邮件帐户。
代码:
from exchangelib import DELEGATE, Account, Credentials, IMPERSONATION, EWSDateTime, EWSTimeZone, Configuration, NTLM, CalendarItem, Message, Mailbox, Attendee, Q
from exchangelib.folders import ExtendedProperty, FileAttachment, ItemAttachment, HTMLBody
import logging
config = Configuration(
#service_endpoint='https://triedthisservertoo.com/EWS/Exchange.asmx',
server='localSMTPserver',
credentials = Credentials(
username='x@xx.com',
password='topsecret'),
auth_type=NTLM,
verify_ssl=False
)
account = Account(
primary_smtp_address='x@xx.com',
autodiscover=False,
config=config,
access_type=IMPERSONATION)
logging.basicConfig(level=logging.DEBUG)
pprint (account.folders())
输出(显然是无限循环):
C:\Users\mcindea\Downloads\dist\exchangelib-1.7.6>python test.py
C:\Users\mcindea\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding c InsecureRequestWarning)
C:\Users\mcindea\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding c InsecureRequestWarning)
C:\Users\mcindea\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\urllib3\connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding c InsecureRequestWarning)