美文网首页
exchangelib.errors.AutoDiscoverF

exchangelib.errors.AutoDiscoverF

作者: 不死鸟F21 | 来源:发表于2021-08-05 15:01 被阅读0次
    # exchangelib.errors.AutoDiscoverFailed
    
    from exchangelib import DELEGATE, Account, Credentials, Message, Mailbox, HTMLBody,Configuration,NTLM
    from exchangelib.protocol import BaseProtocol,NoVerifyHTTPAdapter
    BaseProtocol.HTTP_ADAPTER_CLS = NoVerifyHTTPAdapter
    
    def Email(to, subject, body):
        creds = Credentials(
            username='xxx.com\exadmin',
            password='Spinfo0'
        )
        config = Configuration(server='xxx.com', credentials=creds, auth_type=NTLM)
        account = Account(
            primary_smtp_address='xxx@xxx.com',
            credentials=creds,
            autodiscover=False,
            access_type=DELEGATE,
            config=config
        )
        m = Message(
            account=account,
            subject=subject,
            body=HTMLBody(body),
            to_recipients = [Mailbox(email_address=to)]
        )
        m.send()
    
    Email("xxx@xxx.com", "abc", "def")
    

    相关文章

      网友评论

          本文标题:exchangelib.errors.AutoDiscoverF

          本文链接:https://www.haomeiwen.com/subject/wpvmvltx.html