Почему не отправляет на gmail? python(django)
Вроде все правильно, но выводит ошибку:
(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials w17sm9933602ljd.2 - gsmtp')
Файл views.py :
def remember(request):
global isauth
global all_objects_accounts
global nameforid
if request.method == "POST":
for i in all_objects_accounts:
if i.login == request.POST['login'] and i.email == request.POST['email'] and i.date == request.POST['date']:
print(settings.EMAIL_HOST_USER + "" + settings.EMAIL_HOST_PASSWORD)
send_mail('aaa', 'aaa', settings.EMAIL_HOST_USER, ['[email protected]'], fail_silently=False)
return render(request, 'main/remember.html', {'isauth': isauth, 'all_objects_accounts': all_objects_accounts, 'nameforid': nameforid})
Файл settings.py:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False