Comment envoyer un e-mail SMTP pour Office 365 avec Python en utilisant TLS/SSL
Source : Stack Overflow [office365]
Comment envoyer un e-mail SMTP pour Office 365 avec Python en utilisant TLS/SSL
Source : Stack Overflow [office365]
Eh bien, vous y êtes presque. Le code suivant fera l’affaire :
import smtplib
mailserver = smtplib.SMTP('smtp.office365.com',587)
mailserver.ehlo()
mailserver.starttls()
mailserver.login('[email protected]', 'password')
#Adding a newline before the body text fixes the missing message body
mailserver.sendmail('[email protected]','[email protected]','\npython email')
mailserver.quit()
Utilisez les liens suivants pour plus d’informations :
Python: Send Email via Office 365
https://docs.python.org/3/library/smtplib.html
https://gist.github.com/jasonjoh/3ec367594c3fa662ee983a617bdc7deb