I'm trying to send email with django. Here's my settings.py
file.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'mymail@gmail.com'
EMAIL_HOST_PASSWORD = 'mailpassword'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'mymail@gmail.com'
I've also enabled access to less secure apps in the gmail settings.
On the production server whenever I try to send an email, it's raising an error in the command line upstream prematurely closed connection while reading response header from upstream.
On webpage it's showing 502 Bad Gateway
error.
How can we solve this issue? Thank You . . .