Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Sending Emails: Intro and Account Configuration

In this first video an overview of the course is given. Furthermore, instructions to correctly set up your development mail account are provided.

00:00 Hey there! And welcome to the Real Python guide to sending emails with Python. In this set of videos, you’re going to learn how to use Python’s built-in smtplib library to send a variety of emails.

00:14 First, you’ll learn how to connect to a mail server using two different secure protocols. Next, you’ll see how to send basic emails, and then we’ll pull in Python’s email package so you can send emails with HTML formatting and attachments.

00:31 After that, you’ll see how you can send personalized emails, pulling information off of a CSV file. And finally, you’ll see how to use Yagmail, which is a package set up to make sending emails through Gmail much easier. For the purposes of this guide, we’ll be using Gmail, but the basic principles should apply to any email provider.

00:53 Before you start writing any lines of code, however, you should create a development email account. This is for a couple of reasons. First, you don’t want to clutter your real email account with emails while you’re testing out code. And second, we’re going to need to make some security setting changes to allow our scripts to access the account. Let’s see what that looks like.

01:16 Over here, I’m in my development Gmail account. If you go up here, click on your account, and then go to Security.

01:28 Scroll down until you see Less secure app access,

01:34 and this is what you want to turn on. So click on that, flip the toggle switch, and you should be all set. Now if you go back to your inbox, you should see that you have a security alert from Gmail, which is what you want to see in this case. All right! The email account’s configured. Time to write some code.

Aditya Mathur on Jan. 20, 2023

The toggle option to enable less secure app is no longer there on gmail account.

Gajendrasingh Dawar on Jan. 11, 2024

Where can I learn more about building production-grade email servcing in Python?

Become a Member to join the conversation.