"Connection Refused" Error while sending mails in Django | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

"Connection Refused" Error while sending mails in Django

I am developing a Django based website where I have made a feature that whenever someone fills the contact form and submits it, he receives a confirmation email. I was using Gmail's SMTP. The code was working fine local server. But as soon as I uploaded the project to live server, Gmail started blocking the emails. I googled and found that Gmail blacklists some hosting servers from sending email. So I changed the SMTP to Yahoo's. But then I started getting "Connection Refused" even on my local server. I have also tried some other email services' SMTP. I am using right credentials but then also getting this error. I can't send emails even from local server. Why is it happening?

20th Aug 2021, 5:11 AM
Shashank Shekhar
Shashank Shekhar - avatar
5 Answers
+ 3
I don't think he exceeded the limit as his app is still in development stage and 100 recipients are much ... I think the problem is in the mail server. I found this related questions: https://stackoverflow.com/questions/55569031/django-email-sending-on-heroku Try to use other apps(designed to send mails) like SendGrid as suggested in the answer. I am not familiar with Heroku, but I think they provide installation of such apps/add-ons and there are also free plans available for these services.
24th Aug 2021, 6:38 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 3
Maybe you have exceeded your daily quota? Found this here: https://support.google.com/mail/thread/40988320/i-have-created-gmail-api-for-my-wordpress-website-to-send-mails-but-it-gives-me-error?hl=en "You are allowed only 100 recipients every rollong 24 hours when sending from an app."
24th Aug 2021, 3:33 AM
Tibor Santa
Tibor Santa - avatar
+ 1
If you are using a gmail account then make sure you have enabled "less secured login" in your account.
23rd Aug 2021, 12:03 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
I also think that I should use other apps for sending emails
24th Aug 2021, 4:38 PM
Shashank Shekhar
Shashank Shekhar - avatar
0
I did it. But it worked on local server. Gmail blocked hosting server.
24th Aug 2021, 3:26 AM
Shashank Shekhar
Shashank Shekhar - avatar