Hi. <https://stackoverflow.com/posts/76829177/timeline>
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
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "mail.X.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "...@mydomain"
EMAIL_PASSWORD = "password"
And the error:
Exception Type: SMTPRecipientsRefused at /accounts/password_reset/
Exception Value: {'[email protected]': (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_server = "mail.X.com"
>>> mail_username = "...@mydomain"
>>> mail_password = "password"
>>> mail_port = 587
>>> msg = EmailMessage()
>>> msg["Subject"] = "subject test"
>>> msg["From"] = mail_username
>>> msg["To"] = "[email protected]"
>>> 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)
It is an email account that my company bought.
Thanks for answers.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/cfd8f7b0-3695-469c-b1b3-9e2ddf1c9c15n%40googlegroups.com.