"cannot connect to, port 587: Connection timed out"


I tried this tutorial in order to enabling the email sending facility to the website which is on Droplets.

This worked fine in localhost and email sent/received very quickeley but it doesn’t work in Droplet.:(

This is the error message (when- tail /var/log/msmtp.log)

Jul 25 06:39:08 tls=on auth=on errormsg=‘cannot connect to, port 587: Connection timed out’ exitcode=EX_TEMPFAIL

Please help me :(


Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @aleemfirnas22

If your account with DigitalOcean is new, then all SMTP actions are blocked and you need to create a ticket with Support via the control panel and ask to un-block SMTP. This is to prevent SPAM.

Make sure you’re connecting with it over IPv4, not IPv6. It seems like DO is blocking IPv6 SMTP traffic.

And for what it’s worth, you can test by connecting with Gmail’s servers with the following: $ telnet 587

Then to test with IPv4: $ telnet -4 587

If you see it trying to connect (and failing) with IPv6 with the former command, but succeeding with IPv4 in the latter command, you’ll need make your droplet use IPv4.


How did it work on localhost? What tutorial did you follow?