smtplib/exchangelib连接到电子邮件

2024-09-27 00:19:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我曾经使用自动发现来检索收件箱中的一些电子邮件。然而,上周他们更新了我的电子邮件,自动发现功能不再起作用了。现在我正在使用SMTP_SSL测试与SMTPLIB的连接

server  = smtplib.SMTP_SSL('xxxxxxxx.com',port=25) 

但我知道

^{pr2}$

当我在exchangelib上使用自动发现时

AutoDiscoverFailed                        Traceback (most recent call last)
<ipython-input-48-c03f25ef8bb7> in <module>
      5                     autodiscover=True,
      6                     # config=self.config,
----> 7                     access_type=DELEGATE
      8                         )

c:\python37\lib\site-packages\exchangelib\account.py in __init__(self, primary_smtp_address, fullname, access_type, autodiscover, credentials, config, locale, default_timezone)
     78                 raise AttributeError('config is ignored when autodiscover is active')
     79             self.primary_smtp_address, self.protocol = discover(email=self.primary_smtp_address,
---> 80                                                                 credentials=credentials)
     81         else:
     82             if not config:

c:\python37\lib\site-packages\exchangelib\autodiscover.py in discover(email, credentials)
    221     # We fell out of the with statement, so either cache was filled by someone else, or autodiscover redirected us to
    222     # another email address. Start over after releasing the lock.
--> 223     return discover(email=email, credentials=credentials)
    224 
    225 

c:\python37\lib\site-packages\exchangelib\autodiscover.py in discover(email, credentials)
    211             try:
    212                 # This eventually fills the cache in _autodiscover_hostname
--> 213                 return _try_autodiscover(hostname=domain, credentials=credentials, email=email)
    214             except AutoDiscoverRedirect as e:
    215                 if email.lower() == e.redirect_email.lower():

c:\python37\lib\site-packages\exchangelib\autodiscover.py in _try_autodiscover(hostname, credentials, email)
    259                     ), None)
    260                 log.info('autodiscover.%s redirected us to %s', hostname, e.server)
--> 261                 return _try_autodiscover(e.server, credentials, email)
    262             except AutoDiscoverFailed as e:
    263                 log.info('Autodiscover on autodiscover.%s (no TLS) failed (%s). Trying DNS records', hostname, e)

c:\python37\lib\site-packages\exchangelib\autodiscover.py in _try_autodiscover(hostname, credentials, email)
    277                         return _try_autodiscover(hostname=hostname_from_dns, credentials=credentials, email=email)
    278                     except AutoDiscoverFailed:
--> 279                         raise_from(AutoDiscoverFailed('All steps in the autodiscover protocol failed'), None)
    280 
    281 

c:\python37\lib\site-packages\future\utils\__init__.py in raise_from(exc, cause)
    398         myglobals['__python_future_raise_from_cause'] = cause
    399         execstr = "raise __python_future_raise_from_exc from __python_future_raise_from_cause"
--> 400         exec(execstr, myglobals, mylocals)
    401 
    402     def raise_(tp, value=None, tb=None):

c:\python37\lib\site-packages\exchangelib\autodiscover.py in <module>

AutoDiscoverFailed: All steps in the autodiscover protocol failed

我不知道如何处理这些例外情况


Tags: infrompyemaillibpackagessitehostname

热门问题