Django Email Configuration: SSL Certificate Verification Failed with GoDaddy SMTP Server
I'm trying to configure Django to send emails using GoDaddy's SMTP server (smtpout.secureserver.net
). My email account was created on GoDaddy, and I have the following settings in my settings.py
file:
import os
MAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtpout.secureserver.net'
EMAIL_HOST_USER = os.environ.get("EMAIL_HOST")
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD")
DEFAULT_FROM_EMAIL = os.environ.get("EMAIL_HOST")
EMAIL_PORT = 465
EMAIL_USE_SSL = True
EMAIL_USE_TLS = False
I've set my environment variables as follows:
EMAIL_HOST = ABC@dagger.com # GoDaddy email
EMAIL_HOST_PASSWORD = Abc@1223 # GoDaddy email password
However, when trying to send an email, I get the following error:
File "C:\Users\jinal.desai\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create
self.do_handshake()
File "C:\Users\jinal.desai\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1007)
What I've Tried:
- Verified that my GoDaddy email credentials are correct.
- Tried setting
EMAIL_USE_TLS = True
andEMAIL_USE_SSL = False.
- Used
EMAIL_PORT = 587
instead of465
. - Manually verified that
smtpout.secureserver.net
works using an external email client. - Attempted to disable SSL certificate verification using:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Question:
- How can I fix this SSL certificate verification error with GoDaddy's SMTP?
- Do I need to install or trust a specific SSL certificate for GoDaddy's mail server?
- Is there any known workaround to resolve this issue?
Any help would be appreciated!