Artificial Corner

Artificial Corner

AI & Python 🐍

AI & Python #11: How to Automate Emails with Python

A quick guide to automate boring emails with Python.

Frank Andrade's avatar
Frank Andrade
May 01, 2024
∙ Paid

Do you know what most office jobs have in common? In most of them, you have to send emails regularly.

It doesn't matter if you’re a programmer, data scientist, or engineer, chances are you have to read and respond to emails on a daily basis. This activity doesn’t add any value to our professions, yet it stops our workflow and takes our valuable time.

The solution? Automate it with Python!

In this guide, I’ll show you how to automate sending emails with Python. We’ll be using Gmail in this tutorial, so make sure you have a Gmail account to test out this automation.

1. Turn On 2-Step Verification

Before we start writing code, we need to set up our Gmail account to be able to use it with Python.

In the past, we could easily connect to Gmail with Python by turning on “Less secure app access” but that option isn’t available anymore. What we have to do now is turn on 2-step verification to get a 16-character password that we can use to log in to Gmail using Python.

First, go to your Google account


User's avatar

Continue reading this post for free, courtesy of Frank Andrade.

Or purchase a paid subscription.
© 2026 Frank Andrade · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture