1
votes
  1. My DRF app using rest-auth and allauth wont send new user email activation mail despite these settings.
  2. All I get is a console log that an email was sent after registration but nothing hits a user email.Please advise.

Also, I use gmail and I have enabled unsecured-apps in my gmail account to send emails.

settings.py

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = get_secret('EMAIL_ADDRESS')
EMAIL_HOST_PASSWORD = get_secret('EMAIL_PASSWORD')    
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_AUTHENTICATION_METHOD = 'username'

INSTALLED_APPS = [
    'corsheaders',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'coin_app.apps.CoinAppConfig',
    'allauth',
    'allauth.account',
    'rest_auth.registration',
    'rest_framework',    
    'rest_framework.authtoken',
    'rest_auth',
    'allauth.socialaccount',
]

My dev-environment

Django==3.0.3
django-allauth==0.41.0
django-cors-headers==3.2.1
django-rest-auth==0.9.5
djangorestframework==3.11.0
djangorestframework-jwt==1.11.0
1

1 Answers

1
votes

I noticed that your EMAIL_BACKEND is set to testing mode for console not smtp. You must change it as follows:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'