0

In gmail account security I turned ON the following:

Access to less secure apps AND

Signing in with 2-Step Verification

In view file:

from django.core.mail import send_mail
subject = 'Thank you for registering to our site'
message = ' it  means a world to us '
email_from = settings.EMAIL_HOST_USER
recipient_list = ['john.doe@gmail.com', ]
send_mail(subject, message, email_from, recipient_list)

In settings.py:

EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’
EMAIL_HOST = ‘smtp.gmail.com’
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = ‘myemailaddress@gmail.com’
EMAIL_HOST_PASSWORD = ‘mypassword’

Cannot figure out why getting the error:

ConnectionRefusedError at /email_link_spi/951437/ [WinError 10061] No connection could be made because the target machine actively refused it.

  • Check this [Answer](https://stackoverflow.com/questions/37960035/python-email-errno-10061-no-connection-could-be-made-because-the-target-machi) it might help – Akash senta Dec 22 '21 at 04:09

1 Answers1

0

You can either turn less secure apps to ON , or enable two step verification .. if you prefer enable two step verification then you can create an app password and give that password in EMAIL_HOST_PASSWORD.

akam
  • 1
  • 1
  • @kakam, Not sure you read the first 3 lines of my post. I have turned on "Access to Less Secure Apps" and also turned on "Signing in with 2-Step Verification" I also created an app password. None of this work and still encounter the error. – Scott Norman Dec 24 '21 at 16:55