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 ...

Get Automate it! - Recipes to upskill your business now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.