I am using the django auth views for password reset and setup the Email settings using smtp in settings.py. I am not sure why I am not receiving emails in my gmail. When I send it using the send_mail() function, I am getting emails fine. Does anybody has any idea?
I have configured EMAIL settings in settings.py and added URLs in url.py and made my own template files.
Settings.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PWD')
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
urls.py:
from django.contrib.auth import views as auth_views
path('password-reset/',
auth_views.PasswordResetView.as_view(
template_name='users/password_reset.html'
),
name='password_reset'),
path('password-reset/done/',
auth_views.PasswordResetDoneView.as_view(
template_name='users/password_reset_done.html'
),
name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(
template_name='users/password_reset_confirm.html'
),
name='password_reset_confirm'),
path('password-reset-complete/',
auth_views.PasswordResetCompleteView.as_view(
template_name='users/password_reset_complete.html'
),
name='password_reset_complete'),
path('admin/', admin.site.urls),
I go to the password_reset and enter my email and click Submit. It shows me password_reset_done page but I do not receive any email in my gmail. Any help is greatly appreciated.