I am hosting a Django web application on my DigitalOcean Droplet and need to send emails using Gmail SMTP. However, my server cannot connect to smtp.gmail.com
on ports 587
and 465
.
When I run telnet smtp.gmail.com 587
, it fails with “Connection timed out.” However, ping smtp.gmail.com
works, confirming that my network is reachable.
Please unblock outbound SMTP traffic on ports 587 and 465 for my server so I can send emails.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey there 👋
By default, DigitalOcean blocks outbound SMTP traffic on ports 25, 465, and 587 to prevent spam and abuse. That’s why your connection to
smtp.gmail.com
is timing out.You can either switch to sending emails via a third-party email API provider like SendGrid or Mailgun, or reach out to support and request an unblock — though unblocking is not always guaranteed: 👉 https://do.co/support
More info here: 👉 https://docs.digitalocean.com/support/why-is-smtp-blocked/
- Bobby
Heya,
In order to battle spam DigitalOcean has closed mails ports. What you can try is to contact them and ask for the resriction to be uplifted for your account.
Heya, @rashmijoshi
As you have heard the SMTP ports are now closed for sending emails.
I believe you can use the The Gmail API for authentication and lets you send emails using HTTPS over port 443.
You can find more information here:
https://developers.google.com/gmail/api/guides/sending
Hope that this helps!