How to send SMTP email for office365 with python using tls/ssl

后端 未结 4 1225
时光取名叫无心
时光取名叫无心 2021-02-01 06:25

I am trying to send an email from my office365 corporate account using python. I am new to python. This code previously worked when using my hotmail account, however now that I

4条回答
  •  逝去的感伤
    2021-02-01 07:13

    I found a library that it's working for me:

    https://github.com/O365/python-o365

    https://pypi.python.org/pypi/O365

    Install it using PIP and then:

    from O365 import Message
    o365_auth = ('YourAccount@office365.com','YourPassword')
    m = Message(auth=o365_auth)
    m.setRecipients('reciving@office365.com')
    m.setSubject('I made an email script.')
    m.setBody('Talk to the computer, cause the human does not want to hear it any more.')
    m.sendMessage()
    

提交回复
热议问题