Django sendmail is not working, I'm getting this error:
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials q13sm252028qtx.80 - gsmtp')
There are similar question on S.O.,like this. everyone taking about "allow less secure apps", but I already turn that option ON. My auth details are correct, I had tried with two different accounts. Two step verification is disabled.
settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'myemail'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_USE_TLS = True
views.py
def sendmail(email,token):
subject = 'Verify Email'
message = 'Hello User please activate your account by click on this link '+'http://mywebsite.pythonanywhere.com/email/verify/'+token
from_email = 'praveexxxxxxxxxxx@gmail.com'
recipient_list = [email]
send_mail(subject=subject,message=message,from_email=from_email,recipient_list=recipient_list)
def signup(request):
token = generatedtoken
email = someoneemail@gmail.com
sendmail(email,token)