Hi everyone,
I’m facing an issue with Django’s password reset functionality using Gmail’s SMTP server. Despite following best practices, I’m getting authentication errors (535 5.7.8 Username and Password not accepted
). I’d appreciate guidance from anyone who has overcome similar Gmail restrictions.
What I’ve Tried:
- Generated a 16-digit app-specific password (2-Step Verification enabled)
- Tested both ports
587 (TLS)
and465 (SSL)
- Approved device via Google’s Unlock Captcha
- Verified credentials work in standalone Python scripts but fail in Django
Configuration in python 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 = ‘myapp@gmail.com’ # Actual email replaced
EMAIL_HOST_PASSWORD = ‘app-specific-password’
Error Log:
smtplib.SMTPAuthenticationError: (535, b’5.7.8 … BadCredentials …')
- Are there Android-specific SMTP quirks I’m missing (testing on Pydroid 3)?
- Should I switch to alternative email providers (e.g., Mailgun, SendGrid)?
- Could Google be blocking “less secure apps” despite app passwords?
Any insights or workarounds would be invaluable! I’m happy to share sanitized code/config snippets if needed.
Note:I’ve redacted sensitive credentials above.