varification email is not sending to email address using smtp in local sever in ubuntu

For my django project.i created a registration form where as usual the user is asked for his email address for the varification.Now the problem is when i test the registration form as user and pass my email address,it shows that a varificatio has sent to my email address but there is no email i found my email inbox.

now the question is how do i send email to my email address using local server not the live sever In Ubuntu.In mention i am using smtp and i have put the following in my settings.py file..

EMAIL_FROM = 'raihncse43@gmail.com'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025

and this is my full settings.py file..

import sys
from os.path import abspath, dirname, join


sys.path.insert(0, '../..')

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ROOT_PATH = abspath(dirname(__file__))

ADMINS = (
# ('Your Name', 'your_email@example.com'),
)


EMAIL_FROM = 'raihncse43@gmail.com'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025

MANAGERS = ADMINS

DATABASES = {
 'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': 'test.db'
}
}

TIME_ZONE = 'America/Montevideo'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = ''
MEDIA_URL = ''

STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

SECRET_KEY = '#$5btppqih8=%ae^#&7en#kyi!vh%he9rg=ed#hm6fnw9^=umc'

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'example.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'example.wsgi.application'

TEMPLATE_DIRS = (
join(ROOT_PATH, 'templates'),
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'social.apps.django_app.default',
'example.app',
)

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
    'require_debug_false': {
        '()': 'django.utils.log.RequireDebugFalse'
    }
},
'handlers': {
    'mail_admins': {
        'level': 'ERROR',
        'filters': ['require_debug_false'],
        'class': 'django.utils.log.AdminEmailHandler'
    }
},
'loggers': {
    'django.request': {
        'handlers': ['mail_admins'],
        'level': 'ERROR',
        'propagate': True,
    },
}
}

SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
'social.apps.django_app.context_processors.backends',
)

AUTHENTICATION_BACKENDS = (
'social.backends.amazon.AmazonOAuth2',
'social.backends.angel.AngelOAuth2',
'social.backends.aol.AOLOpenId',
'social.backends.appsfuel.AppsfuelOAuth2',
'social.backends.behance.BehanceOAuth2',
'social.backends.belgiumeid.BelgiumEIDOpenId',
'social.backends.bitbucket.BitbucketOAuth',

)

LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/done/'
URL_PATH = ''
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
SOCIAL_AUTH_GOOGLE_OAUTH_SCOPE = [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/userinfo.profile'
]
# SOCIAL_AUTH_EMAIL_FORM_URL = '/signup-email'
SOCIAL_AUTH_EMAIL_FORM_HTML = 'email_signup.html'
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = 'example.app.mail.send_validation'
SOCIAL_AUTH_EMAIL_VALIDATION_URL = '/email-sent/'
# SOCIAL_AUTH_USERNAME_FORM_URL = '/signup-username'
SOCIAL_AUTH_USERNAME_FORM_HTML = 'username_signup.html'

#For Facebool Login using Social Auth
SOCIAL_AUTH_FACEBOOK_KEY='149560535145169'
SOCIAL_AUTH_FACEBOOK_SECRET='8db9dc18b04804895af8cf7a18fe5a4b'
SOCIAL_AUTH_FACEBOOK_APP_NAMESPACE = 'kothaymtl'
#SOCIAL_AUTH_FACEBOOK_EXTENDED_PERMISSIONS = ['email']


SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'example.app.pipeline.require_email',
'social.pipeline.mail.mail_validation',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'
)

try:
from example.local_settings import *
except ImportError:
pass

now is that enough to do that or what actually i am missing here...

Answers


You would need to setup an smtp server on your local machine. Postfix a great software for smtp emails.

The easiest way is to setup postfix to use your gmail account to send out email. Here is a link to a nice tutorial for the same: https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/

After configuring Postfix, you can set the EMAIL_PORT=25 or just leave it to default, and you are ready to send out emails.


If you are using Gmail account for sending the mail, you would have to use smtp.gmail.com as the host with port 465 and encryption 'ssl'


Need Your Help

How do I get output from command prompt to a java program

java batch-file

I am running a .jar file which produces output in command prompt. I need the output from command prompt window to print it in a UI.

Magnific Popup : select specific file types

javascript jquery magnific-popup

I would like to select only jpg file and use magnific popup.