Report this

What is the reason for this report?

"cannot connect to smtp.gmail.com, port 587: Connection timed out"

Posted on July 25, 2017

Hi,

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 host=smtp.gmail.com tls=on auth=on user=aleem.firnas22gmail.com from=aleem.firnas22@gmail.com recipients=aleem.firnas22@gmail.com errormsg=‘cannot connect to smtp.gmail.com, port 587: Connection timed out’ exitcode=EX_TEMPFAIL

Please help me :(

Thanks.



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.

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.

@aleemfirnas22

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

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 smtp.gmail.com 587

Then to test with IPv4: $ telnet -4 smtp.gmail.com 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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.