Learn to Code via Tutorials on Repl.it!

← Back to all posts
🐍 Sending emails with python script!


Hello everyone! My name is txasdev, and I'm a learning web developer. Recently I have discovered a very cool script that will send emails with python using the smtplib library. This script is very easy, learn how to use it below.

Script Info

This script sends an email using python. By logging in to a Gmail account with python you can send emails using this tutorial. This tutorial shows you how to send basic emails and emails with files attached. These scripts are used to send emails from a Gmail account (can be configured for other email servers). This will allow you to send emails when your script finishes executing, has come to an error or just needs to send some data to you.

Before Starting

Before you start this, make sure you have your Gmail username and password ready. The account you are going to use must not have 2-Step Verification enabled as we will no longer be able to log in.

Next, go to https://myaccount.google.com/lesssecureapps and log in if you need to. On this page, you will want to flick the Allow less secure apps switch to on. This allows us to use less secure sign-in technology to login to the email server; note that this will make your account more vulnerable. (Nitratine)


(Simple Layout)

(Better Layout)





Ending Note

Thanks for reading my Programmers Blog, if you have any questions you can send me a email with the address of [email protected] and as usual hope you enjoyed! Refer to my email for donations, questions, or concerns such as code issues.