I'm trying to send an email in Python
It's working without problem with gmail with this code :
import smtplib
sender = 'xxx@xxx'
receivers = ['[email protected]']
message = "hello"
try:
smtpObj = smtplib.SMTP('smtp.gmail.com:587')
smtpObj.starttls()
smtpObj.login('[email protected]', 'my_password')
smtpObj.sendmail(sender, receivers, message)
smtpObj.quit()
print("okay")
except:
print("notokay")
But when i use it with office 365, the email is send but the message is empty.
It's the same code but with 'smtp.office365.com:587' with my correct login and password.