python exchanglib 发送html邮件

def Email(to, content):
    urllib3.disable_warnings()
    creds = Credentials(
        username=‘algex\spsaccount‘,
        password=‘Spsaccount‘
    )
    config = Configuration(server="smtp.algex.asmpt.com", credentials=creds, auth_type=NTLM)
    account = Account(
        primary_smtp_address=‘‘,
        credentials=creds,
        autodiscover=False,
        config=config,
        access_type=DELEGATE
    )



    m = Message(
        account=account,
        subject="Guest pass key generated",
        body=HTMLBody(content),
        to_recipients = [Mailbox(email_address=to)],
        cc_recipients = [Mailbox(email_address=cc)],
    )

    m.send()

上一篇文章:https://www.cnblogs.com/jpinsz/p/12418876.html 说到了使用smtplib来发邮件,但是用特定户口时提示535, b‘5.7.3 Authentication unsuccessful‘报错,一时无法解决

于是找到另一种办法,是用于与exchange server一起使用的,完美解决了我的问题,这里大概记录下,日后有用,嘿嘿