我正在尝试在 Exchange 2010 中检索 DL 的电子邮件地址。我尝试了此 url 中的代码,但出现错误。
https://github.com/ecederstrand/exchangelib
# primary_smtp_address: what should be provided here?
# cred: do we need to provide admin users to retrieve data?
from exchangelib import DELEGATE, Account, Credentials, Configuration
cred = Credentials(username='domain\username',password='xxxx')
config = Configuration(server='exchangeserver.com', credentials=cred)
account = Account(primary_smtp_address='def@xyz.com', config=config, autodiscover=False, access_type=DELEGATE)
for mailbox in account.protocol.epxand_dl('abc@xyz.com'):
print(mailbox.email_address)
而不是结果低于错误。
Traceback(最近一次通话最后):文件“E:\Sheik-Backup\Sheik-Backup\Workspace\FlaskProject\maillist.py”,第 11 行,在 a=Account(...) 文件“E:\Python Virtual- Env\Development\lib\site-packages\exchangelib\account.py",第 57 行, 如果 '@' 不在 primary_smtp_address中,则在init中:TypeError:'ellipsis' 类型的参数不可迭代