4 years ago

Gmail connection could not be established with host smtp.gmail.com

Posted 4 years ago by michaelvolst

Heey there,

Recently I had trouble setting up gmail on my forge server on digitalocean. I didn't need something like mandrill or mailgun, just something simple. Everytime I wanted to send an email to my own account and used the server I had this error, but not on my local machine. I searched everywhere, but couldn't find a decent answer that solved the problem, so I ended up with digitalocean using their support ticket system.

The guy that helped me said that I sent my mail over ipv6 rather than ipv4.

He told me that I had to edit this file /etc/gai.conf on the server.

So you should do sudo nano/vim /etc/gai.conf

And you should uncomment this line "precedence ::ffff:0:0/96 100"

This should force the server to connect with ipv4 over ipv6

And restart your server in the forge control panel or do it manualy

I thought this would help you guys/girls out and off course the credits goes to digitalocean and their support team

Please sign in or create an account to participate in this conversation.