https://stackoverflow.com/questions/72478573/sending-and-email-using-python-problem-causes-by-last-google-policy-update-on?fbclid=IwAR1N--0GV5ua_K5mWu8SWgHugydiHmTuvEUlI2QvJ27MFY1sy1IwSSr78Oc
Solved it by creating App password. You must got to Google account. Security tab, active 2 Step Verification. After this new option under "Signing in to Google" the "App passwords" option will be actived. Just create one app password and use as password to authenticate
Here is a more precise answer with all the main steps. I hope it will help other people.
Log in into your email account: https://myaccount.google.com
Then go to the security part
Be sure that you have turn on two steps verification and click on "App password"
- After select email and the corresponding device
- It will generate a password that will look like this; it is this password that you have to use in your python script.
- 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).
Hope it will help other people!