Hi.
I was trying to use Django's accounts system and configured some
templates. When I tried to do password reset, it said
"SMTPRecipientsRefused at /accounts/password_reset/". But it works when I
send an email with smtplib.
In Django settings:
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_PORT = 587
EMAIL_HOST_USER = "....@mydomain"
EMAIL_PASSWORD = "password"
And the error:
Exception Type: SMTPRecipientsRefused at /accounts/password_reset/
Exception Value: {'....@gmail.com': (450, b'4.7.1 We do not relay gmail.com')}
But i knew i used the same mail before with smtplib and tried again, and it worked.
>>> import smtplib
>>> from email.message import EmailMessage
>>> mail_username = "...@mydomain"
>>> mail_password = "password"
>>> mail_port = 587
>>> msg = EmailMessage()
>>> msg["Subject"] = "subject test"
>>> msg["From"] = mail_username
>>> server = smtplib.SMTP(mail_server, mail_port)
>>> server.login(mail_username, mail_password)
(235, b'2.7.0 Ok')
>>> server.send_message(msg)
{}
>>> server.quit()
(221, b'2.0.0 Bye')
I tried adding DEFAULT_FROM_EMAIL = "...@mydomain" to the settings.py, but it didn't make any difference.
I tried adding EMAIL_USE_TLS=True, but it said:
SSLCertVerificationError at /accounts/password_reset/
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'mail.X.com'. (_ssl.c:1131)
I don't know what is the problem. Is it because of Django or something from mail server. It is a mail account that my company bought for the project.
Thanks for the answers.