How to send an email using python after Google’s policy update on not allowing just username and password?

Here is a more precise answer with all the main steps. I hope it will help other people.

  1. Log in into your email account: https://myaccount.google.com

  2. Then go to the security part

enter image description here

Be sure that you have turn on two steps verification and click on “App password”

enter image description here

  1. After select email and the corresponding device

enter image description here

  1. It will generate a password that will look like this; it is this password that you have to use in your python script.

enter image description here

  1. This password will appear here; in this place, you will have the option to erase it (so it will be no longer be useful to connect to your email account).

enter image description here

Hope it will help other people!

Leave a Comment