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
Well, you are almost there. The following code will do the trick:
import smtplib
mailserver = smtplib.SMTP('smtp.office365.com',587)
mailserver.ehlo()
mailserver.starttls()
mailserver.login('user@company.co', 'password')
mailserver.sendmail('user@company.co','user@company.co','python email')
mailserver.quit()
Use the following links for more information:
http://www.aventistech.com/2016/03/07/python-send-email-via-office-365-tls/
https://docs.python.org/3/library/smtplib.html
https://gist.github.com/jasonjoh/3ec367594c3fa662ee983a617bdc7deb