Search code examples
pythondjangodjango-registration

django-registration module dont send email


I am trying to send activation email and reset email in Django. I am using Django registration module but after registration, the page returned back to the registration page and did not send any email to me. Part of settings.py :

DEBUG = False

ALLOWED_HOSTS = ['mysite.com', 'www.mysite.com']

EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend' 
DEFAULT_FROM_EMAIL = 'info@mysite.com'
EMAIL_HOST_USER = 'info@mysite.com'
EMAIL_HOST_PASSWORD = 'my pass'
EMAIL_USE_TLS = True 
EMAIL_PORT = 1025

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'posts',
    'registration',
    'django_countries',
    'crispy_forms',
    'django_forms_bootstrap',
    'captcha', 
   ]

ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
SITE_ID = 1

After clicking on the register button, browser waits for 2 seconds on this page.

enter image description here


Solution

  • You forget to add

    EMAIL_HOST = 'smtp.mysite.com' 
    

    to send email.