<https://stackoverflow.com/posts/76829177/timeline>

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_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: {'....@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_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"] = "....@gmail.com" 
>>> 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.

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87f202c8-80ec-462d-8397-5b363113a3e2n%40googlegroups.com.

Reply via email to