all-auth SMTPAuthentication错误

时间:2017-08-25 03:04:13

标签: django smtp django-allauth django-settings

我收到SMTPAuthenticationError at /rest-auth/password/reset/错误。

我使用all-auth-rest并在settings.py上设置这些

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'randomemail@gmail.com'
EMAIL_PORT = 25 # or 587
EMAIL_HOST_PASSWORD = 'mypassword'

此外,我启用了Displaying an Unlock Captcha并允许less secure app access

缺少什么?

由于

1 个答案:

答案 0 :(得分:1)

  

此配置如果您使用smtp.gmail.com,则其他smtp与此配置类似。

  1. 解锁Captha:https://accounts.google.com/DisplayUnlockCaptcha
  2. 更改为有效:https://www.google.com/settings/security/lesssecureapps
  3. EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_PORT = 587
    EMAIL_HOST_USER = 'your_gmail@gmail.com'
    EMAIL_HOST_PASSWORD = 'your_password'
    EMAIL_USE_TLS = True
    DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    

    我想你错过了:EMAIL_BACKEND