O'Reilly logo

Automate it! - Recipes to upskill your business by Chetan Giridhar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending e-mail messages

The first and foremost thing that you may want to achieve with an e-mail client is to send a message to your friend's or colleague's e-mail address. Let's go ahead and see how we can achieve this in Python.

Getting ready

In order to send e-mail messages, we will need to have Python's smtplib module. This library, as the name suggests, uses the SMTP protocol to send e-mail messages. We can install smtplib with our favorite pip tool with the following command. But Python's default installation should also have this module already:

pip install smtplib

How to do it...

  1. On your computer, open your favorite editor and add the following code snippet. Let this be known as config.py. The configuration file has login details, such as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required