Comment envoyer un email SMTP pour Office365 avec Python en utilisant TLS/SSL
Comment envoyer un email SMTP pour Office365 avec Python en utilisant TLS/SSL
Comment envoyer un email SMTP pour Office365 avec Python en utilisant TLS/SSL
Re: Comment envoyer un email SMTP pour Office365 avec Python en utilisant TLS/SSL
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 : Envoyer un email via Office 365*](https://web.archive.org/web/20201129170339/http://www.aventistech.com/2016/03/07/python-send-email-via-office-365-tls/)
```
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 : Envoyer un email via Office 365*](https://web.archive.org/web/20201129170339/http://www.aventistech.com/2016/03/07/python-send-email-via-office-365-tls/)