[Django]-DJANGO EMAIL CONFIRMATION: [WinError 10061] No connection could be made because the target machine actively refused it


You missed a little bit trivial thing.
in settings.py

It should be EMAIL_HOST = 'smtp.gmail.com'

Not EMAIL_HOSTS = 'smtp.gmail.com'


Two things:

One, like Mohab said, it should be EMAIL_HOST = 'smtp.gmail.com', not EMAIL_HOSTS = 'smtp.gmail.com'. Fix that and it may work.

But if that doesn’t work that means that Google is blocking your email address from being used to send automated mails. You have to enable less secure apps in Gmail settings. Not the most safe option, but that’s okay. Note: if you don’t send automated emails for a long time, Google will automatically turn this setting OFF.

If this was the problem, then Google would have most likely sent you a Critical Security Alert with the same instructions as in this answer. Check this Stack Overflow post for more.

Leave a comment