I was trying to make the custom password reset view for django.contrib.auth.views.password_reset
.
I made it by myself (Of course, I see some tutorial articles.)
But when I request the password reset form to the development server,
It shows like this (on the development server log):
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Hello
From: <My email address> (Outlook)
To: <My another email address> (GMail)
Date: Wed, 22 Aug 2018 11:44:55 -0000
Message-ID: <20180822114455.3320.17387@Yeonhos-MacBook-Pro.local>
I am testing Django EmailMessage Class
But, It doesn't send anything to my address which is marked as My another email address
.
Can anyone help me? Why doesn't Django send this e-mail?
If you are using G mail, you need to enable 2FA(2 Factor Authentication) and go to App passwords setting. Then you can generate app password, and you must put that password into Django settings.py like this:
#settings.py
SERVER_EMAIL = DEFAULT_FROM_EMAIL = EMAIL_HOST_USER = 'YOUR_GMAIL_ADDRESS'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_PASSWORD = 'YOUR_APP_PASSWORD'
It worked for me :)
See this article for how to generate app password and use it for django:
https://kinsta.com/knowledgebase/free-smtp-server/
(You can skip step 4)