<p>Eh bien, vous y êtes presque. Le code suivant fera l’affaire :</p>
<pre><code class="lang-auto">import smtplib
mailserver = smtplib.SMTP('smtp.office365.com',587)
mailserver.ehlo()
mailserver.starttls()
mailserver.login('user@company.co', 'password')
#Adding a newline before the body text fixes the missing message body
mailserver.sendmail('user@company.co','user@company.co','\npython email')
mailserver.quit()
</code></pre>
<p>Utilisez les liens suivants pour plus d’informations :</p>
<p><a href="https://web.archive.org/web/20201129170339/http://www.aventistech.com/2016/03/07/python-send-email-via-office-365-tls/"><em>Python: Send Email via Office 365</em></a></p>
<p><a href="https://docs.python.org/3/library/smtplib.html">https://docs.python.org/3/library/smtplib.html</a></p>
<p><a href="https://gist.github.com/jasonjoh/3ec367594c3fa662ee983a617bdc7deb">https://gist.github.com/jasonjoh/3ec367594c3fa662ee983a617bdc7deb</a></p>