As we know google has removed the less secure app access feature. So while trying to use SMTP, people are facing smtplib.SMTPAuthenticationError. Here are some steps which you can follow to remove smtplib.SMTPAuthenticationError.
Reasons why this error is happening.
1. Gmail user and password are not accepted while sending emails.
2. Google has removed the less secure app option.
3. You are using your Gmail password, not using the app password.
Solution.
1. Go to your google account (https://myaccount.google.com/?hl=en&utm_source=OGB&utm_medium=act&nlr=1)
2. In the security section go to App password. (Note: Make sure that your 2-step verification is on)
3. Select app = Other then it will ask you to Select the app and device you want to generate the app password for, set it to the website, and Click on Generate. It will generate a password.
4. Copy this password and use this password now for sending emails.
I would greatly appreciate it if you subscribe to my YouTube channel, Let's Code More