Django email not sending

Hello. In my project, I inherit the PasswordResetForm and PasswordResetView to add some custom functionality, which allows a user to enter their username or email, and receive an email to that users account.

Displayed here (should a queryset of matching users):

forms file
class MyPasswordResetForm(PasswordResetForm):
    email = forms.CharField(min_length=2)

    # Method on PasswordResetForm found at GitHub link below (Should return queryset of 

    def get_users(self, email):
            user = User.objects.filter(username=email)
            return user
        except User.DoesNotExist:
                user = User.objects.filter(email=email)
                return user
            except User.DoesNotExist:
                return None


# Override property of PasswordResetView to work with my custom form
class MyPasswordResetView(PasswordResetView):
    form_class = MyPasswordResetForm

I then expect an email to be sent to the user, however it isn’t. I don’t receive any error from the console, even when using:
EMAIL_BACKEND = ‘django.core.mail.backends.console.EmailBackend’

The email is being sent using EmailMultiAlternatives, therefore I cannot set fail_silently to false. The function that sends the email is named send_mail, and is found in the PasswordResetForm on this page:

I have all the email requirements setup in the settings file, and I have also allowed less secure apps option in my gmail account.


These are all the properties I set in the settings file. Does anybody have any idea what is failing here? Thanks.

I don’t see anything immediately wrong, but if I were in your situation, these would be the things I would investigate.

  • When you’re using the console backend, are you seeing the emails being generated?

  • Are you sure you’re matching the case of the email or username? (You’re using a case-sensitive comparison in your filter)

  • If you’re using a custom user model, you need to use the get_user_model method to get the reference to the right model. (Notice that the get_users method in the standard form is calling get_email_field_name on the UserModel model)

  • Looking at that form, you could also override the send_mail method to verify that the email is being generated properly.

For example, I might add the following function to my form class:

def send_mail(self, *args, **kwargs):
    super().send_mail(*args, **kwargs)

This would let me verify that the to_email field is right. (along with all the other fields being passed to that method)


@KenWhitesell Thank you, this helped a lot,