I got the following error:
smtplib.SMTPAuthenticationError: (534, b'5.7.9 Application-specific password required. Learn more at\n5.7.9 support.google.com/mail/?p=InvalidSecondFactor l5-20020a05620a28c500b006b5f06186aesm4769153qkp.65 - gsmtp')
I have this:
from decouple import config EMAIL_HOST = config('EMAIL_HOST') EMAIL_PORT = config('EMAIL_PORT', cast=int) EMAIL_HOST_USER = config('EMAIL_HOST_USER') EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD') EMAIL_USE_TLS = True
I think the problem come from the .env file because I have the new password from google setting up properly.
# SMTP configuration EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_HOST_USER=myemail@gmail.com EMAIL_HOST_PASSWORD=blabla1234fromgoogle
According to Google's new sign-in policy, you need to create App Password to send emails from your application. So create App Password by following this article https://support.google.com/accounts/answer/185833 and set that 16-digit app password to EMAIL_HOST_PASSWORD
in your settings.py.