Django registration email not sending

2024/11/13 13:55:42

I've been trying to get the django-registration-redux account activation email to send to newly registered users.

I've gotten all non-email related parts to work, such as loggin in/out and actually registering the user! When i register, it automatically logs my in as that user. But i never get the activation email.

I've tried various different things to try get this to work, I've followed some tutorials on setting whole thing up but the emails still dont work.

heres some of the code setup, im using registration templates that i downloaded online.

settings.py

INSTALLED_APPS = ('django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','registration','synths',
)# user reg settings
REGISTRATION_OPEN = True
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = TrueLOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'# i tried including this line but still nothing
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'# email
# first i tried setting up the debbuging server with this CMD line
# python -m smtpd -n -c DebuggingServer localhost:1025
# i dont know if it worked!, i got no errors but the cursor just
# sat there blinking at me! i was expecting some output to tell me
# the server had started
# these were the settings i used for thatEMAIL_HOST = '127.0.0.1'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''# then i tried using my own address and smtp.live.comEMAIL_HOST = 'smtp.live.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = '123123abcabc'# still nothing

am i missing any important settings here?

urls.py

# included amongst my other urls
(r'^accounts/', include('registration.backends.simple.urls')),

seems all in order with the tutorials and documentation. like i said, registration works perfectly bar the emails.

one thing ive noticed is that you probably shouldn't have auto loggin = True if you want a user to activate their accounts, but commenting that line out didnt change anything, i still got logged in automatically after registering. Seems like a minor aside but maybe this has something to do with the emails not working?

i dunno, im lost with it. Either im missing some settings, the code doesnt work, python smtpd doesnt work, or my smtp.live.com settings are wrong!

any insigths greatly appreciated!

EDIT: when trying the 'reset password' email function i get this error

SMTPException at /accounts/password/reset/SMTP AUTH extension not supported by server.Request Method:     POST
Request URL:        http://localhost:8000/accounts/password/reset/
Django Version:     1.7.6
Exception Type:     SMTPException
Exception Value:    SMTP AUTH extension not supported by server.Exception Location: C:\Python34\lib\smtplib.py in login, line 613
Python Executable:  C:\Python34\python.exe
Python Version:     3.4.3

EDIT 2: using these settings i get the the password/reset/done page but recieve no actual email

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'EMAIL_HOST = '127.0.0.1'
EMAIL_PORT = 1025
Answer
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

will only display the email on the console.

Instead you should use

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

Moreover it is more convenient to use a existing smtp server like gmail

For that you need to add these to your django settings file

EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'                                                                             
EMAIL_HOST ='smtp.gmail.com'                                   
EMAIL_PORT = 587                                                             
EMAIL_HOST_USER = '[email protected]'                              
EMAIL_HOST_PASSWORD = 'gmail app password' #This is not your gmail password.
EMAIL_USE_TLS = True

More help on the password can be found here

https://en.xdnf.cn/q/72077.html

Related Q&A

NumPy data type comparison

I was playing with comparing data types of two different arrays to pick one that is suitable for combining the two. I was happy to discover that I could perform comparison operations, but in the proces…

A simple method for rotating images in reportlab

How can we easily rotate an image using reportlab? I have not found an easy method. The only way found comes from http://dods.ipsl.jussieu.fr/orchidee/SANORCHIDEE/TEMP/TEMP_LOCAL/cdat_portable/lib_new…

XML header getting removed after processing with elementtree

i have an xml file and i used Elementtree to add a new tag to the xml file.My xml file before processing is as follows <?xml version="1.0" encoding="utf-8"?><PackageInfo …

How to ntp server time down to millisecond precision using Python ntplib?

I am creating a python module that will output the time from a selection of NTP Pool servers to millisecond precision as an exercise in showing how server timestamps vary. Thus far I have been able to …

Control 2 separate Excel instances by COM independently... can it be done?

Ive got a legacy application which is implemented in a number of Excel workbooks. Its not something that I have the authority to re-implement, however another application that I do maintain does need t…

nested Python numpy arrays dimension confusion

Suppose I have a numpy array c constructed as follows:a = np.zeros((2,4)) b = np.zeros((2,8)) c = np.array([a,b])I would have expected c.shape to be (2,1) or (2,) but instead it is (2,2). Additionally,…

how to reuse tests written using unittest.testcase

Ive written some tests using unittest as below and I want to reuse them in another class where Im stuck and need help.. Code snippets are as below.MyTestClass.pyClass MyTestClass(unittest.TestCase): …

Randomized stratified k-fold cross-validation in scikit-learn?

Is there any built-in way to get scikit-learn to perform shuffled stratified k-fold cross-validation? This is one of the most common CV methods, and I am surprised I couldnt find a built-in method to …

Find all paths through a tree (nested dicts) from top to bottom

EDIT: See below for a suggested answer and how its not quite right yet.There are many similar questions to this one on Stack Overflow, but none exactly like it in Python. Im a programming novice, so pl…

How to show process state (blocking, non-blocking) in Linux

Is there a way to query the state of processes in a Linux process table to be able to demonstrate if a process is running or blocked at the time the query is executed? My goal is to do this from outsi…