1
votes

I'm using the built in Django password reset, and the 'password reset sent' page comes up, but the email never sends. I have my email settings setup like this:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'my_email'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = 'my_password'

I included the following since I'm in development, but not totally sure if it's necessary:

ALLOWED_HOSTS = ['localhost']

The console says:

MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Subject: Password reset on localhost:8000
From: [email protected]
To: [email protected]
Date: Wed, 17 Feb 2016 04:53:17 -0000
Message-ID: <[email protected]>

It looks like everything is happening that should, but the email never sends. Am I doing something wrong here?

1

1 Answers

4
votes

You are using the dummy email backend used for testing only. Change the line

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

to

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

From the docs:

Console backend

Instead of sending out real emails the console backend just writes the emails that would be sent to the standard output. By default, the console backend writes to stdout. You can use a different stream-like object by providing the stream keyword argument when constructing the connection.