This is my settings.py
:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'my_email'
EMAIL_HOST_PASSWORD = 'my_password'
This is the views.py
(shortened):
from django.core.mail import send_mail
send_mail(
'Test available',
available_tests,
'from_email',
['to_email'],
fail_silently=False,
)
I get this error when I run it:
SMTPAuthenticationError at /tests/
(534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs\n5.7.14 CVdm_z3V04RKsRDOt2x5M1_yESoNRrgFFsNUmyDXD8679rHU8-6CSTiu3ujGvVe8dPA60\n5.7.14 pLNZp8_g5c5UfqE2IHWTkrvJOzc4O4jE5DjTp2YRJ__hH6SKUYjo258WdrVuTvXw>\n5.7.14 Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 e1sm15524806qtw.71 - gsmtp')
I've allowed less secure apps in my google account, I've clicked that it was me in the email, how do I fix it?
CodePudding user response:
I've had this issue often and what worked for me was going to the link in the support doc:
https://accounts.google.com/b/0/DisplayUnlockCaptcha
And clicking the "Continue" button
CodePudding user response:
I think you didn't turn on "less secure app" option for your gmail. Open this link https://myaccount.google.com/intro/security, this should fix your problem.