Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language 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 With Yagmail

Give Feedback

In the past lessons you had to write a lot of boilerplate code to send emails the way you wanted. In this lesson, you’ll meet Yagmail, which is a Python library created to interact with Gmail accounts and making it a lot easier to send emails via Python by writing less code.

Note: Don’t forget to install it via pip install yagmail

sion on April 25, 2019

Very helpful, very interesting and well presented. Thank you

Joe Tatusko RP Team on April 25, 2019

You’re welcome! I’m glad you enjoyed it :D

yraheem on May 1, 2019

Awesome!!! I did have issues with the Yagmail module. I had to specify my username and password in creating the yag object like; yag = yagmail.SMTP(username, password) because without it the python interpreter raised an exception; file “C:......\site-packages\yagmail\password.py, in handle_password, password= keyring.get_password(“yagmail”, user) once I added my username and password, things seems to align.

Marc Gehling on May 1, 2019

same error as @yraheem, solved with “pip install yagmail[all]”

charliem22 on May 28, 2019

Excellent tutorial! Very clearly presented and logically structured! This is a model of how on-line education can work. Thanks for taking the time to make this!! charlie

carykinsfather on Aug. 20, 2019

You can also just pip install keyring to get it working. I couldn’t get [all] to work as shown above.

mikesult on Feb. 26, 2020

Great tutorial Joe. I learned some really useful techniques regarding email. Thanks!

Become a Member to join the conversation.