I set up an email account with NameCheap that I use with my Django app. Below is my email configuration based on information provided by NameCheap
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.privateemail.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_PASSWORD')
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = 'WebsiteTitle <[email protected]>'
Now when I use send_mail()
django function (eg. after registration) it is like playing roulette - one time it works properly and sends out an email, another time it throws an error saying
SMTPServerDisconnected at /reset-password/ Connection unexpectedly closed
As if something was wrong with my email configuration.
Do you have any idea what might cause it or how to try to fix it or debug it? Is it more likely NameCheap or Django?
hope you solved it otherwise for any other person who is stuck. FOR EMAIL HOST USE "smtp.privateemail.com", the other parameters are ok.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.privateemail.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_PASSWORD')
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = 'WebsiteTitle <[email protected]>'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With