Send Email via Outlook and SMTP
Microsoft's email service, Outlook (formerly Hotmail), allows application developers to send emails through the SMTP protocol. This is what you need to know about Outlook's SMTP server:
Security protocol: TLS
With this information and the help of the standard
smtplib modules, we can use the following code to send an email from an Outlook account (it also accepts the old @hotmail.com, @live.com, etc.):
You'll need to replace
"my_outlook_password_123" with the credentials of the Outlook account which you want to send the email from.
For a general explanation of the structure of this code and how to include HTML code and/or file attachments, see our post on the
smtplib modules: Send HTML Email With Attachments via SMTP.