Search code examples
djangosmtpdjango-allauthdjango-settings

all-auth SMTPAuthentication Error


I'm getting SMTPAuthenticationError at /rest-auth/password/reset/ error.

I'm using all-auth-rest and set these on 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'

Also I enabled Displaying an Unlock Captcha and allowed less secure app access

What is missing?

Thanks


Solution

  • This configurations is if you work with smtp.gmail.com, other smtp is similiar with this configuration.

    1. Unlock Captha: https://accounts.google.com/DisplayUnlockCaptcha
    2. Change to active: https://www.google.com/settings/security/lesssecureapps

    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'
    

    I think you missed: EMAIL_BACKEND