Django email not sending — no error, but messages don’t arrive (using Gmail SMTP)

I’m trying to send emails from my Django project using Gmail’s SMTP server. The server runs without any errors, and my code executes successfully, but the emails never reach the recipient — not even in the spam folder.

I’ve enabled 2-Step Verification on my Gmail account and generated an App Password specifically for this project, but it still doesn’t work.

I want to understand why Django thinks the email was sent but it never actually arrives.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_USE_SSL = True
EMAIL_HOST_USER = 'mygmail@gmail.com'
EMAIL_HOST_PASSWORD = 'my-16-digit-app-password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER

i the Expected result was Recipient receives the email. but the actual result is Email never arrives, and no errors are raised.

I remember that if you’re sending from mygmail@gmail.com but your "From" header or envelope sender differs (e.g., another domain), Gmail may silently discard the message.

Try sending like this:

from django.core.mail import send_mail

send_mail(
    subject='Test Email',
    message='This is a test.',
    from_email='mygmail@gmail.com',  # must match EMAIL_HOST_USER
    recipient_list=['recipient@example.com'],
    fail_silently=False,  # IMPORTANT for debugging
)

For debugging email issues in Django, you can temporarily switch to the console backend:

# settings.py
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

This prints the full raw email message Django would send to your console. Check that the From, To, and Subject headers are correct before switching back to the SMTP backend.

Back to Top