[英]Django SMTP Error: authentication failed: authentication failure
I set up django email backend following way: 我按照以下方式设置了django电子邮件后端:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending e-mail.
EMAIL_HOST = 'mytdl.de'
# Port for sending e-mail.
EMAIL_PORT = 25
# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = 'me@mytdl.de'
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
But sending emails with django-allauth will return following error: 但是使用django-allauth发送电子邮件将返回以下错误:
(535, b'5.7.8 Error: authentication failed: authentication failure')
Testing the the settings with 使用测试设置
telnet mytdl.de 25
or Thunderbird as email client works fine. 或Thunderbird作为电子邮件客户端工作正常。
2.7.0 Authentication successful
But Django / SMTP stills throws that error. 但是Django / SMTP仍然会引发错误。 Django also tries to
Django也试图
AUTH CRAM-MD5
and not 并不是
AUTH LOGIN
any ideas? 有任何想法吗?
If your email host is gmail then you can fix it with these simple steps: 如果您的电子邮件主机是Gmail,那么您可以通过以下简单步骤进行修复:
Also maintain your settings variables in this order: 还按此顺序维护设置变量:
settings.py settings.py
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'example@gmail.com'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_PORT = 587
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.