Hey, I changed `EMAIL_PASSWORD` to `EMAIL_HOST_PASSWORD` and added the `DEFAULT_FROM_EMAIL`, now it works. See my Stack Overflow question <https://stackoverflow.com/questions/76829177/django-can-not-send-mail-but-smtplib-can>. I don't understand why the server said "We do not relay gmail.com" if there is a problem with the password. Have a good day, everyone. 4 Ağustos 2023 Cuma tarihinde saat 12:55:49 UTC itibarıyla Kerem Üllenoğlu şunları yazdı:
> <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: {'[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) > > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/79d4ca5a-66c6-4065-bc86-27cc3cb82849n%40googlegroups.com.

