Net::OpenTimeout (execution expired) exception with Rails mailer

谁都会走 提交于 2019-11-28 08:47:01

My VPS provider (DigitalOcean) blocked SMTP on IPv6 by default :(

I had to disable IPv6 on server with next config:

# /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1 
net.ipv6.conf.default.disable_ipv6 = 1 
net.ipv6.conf.lo.disable_ipv6 = 1 

Apply settings:

$ sysctl -p

Uncomment the next line in /etc/gai.conf to prefer IPv4:

precedence ::ffff:0:0/96 100

And remove IPv6 DNS from /etc/resolv.conf:

nameserver 2001:4860:4860::8844 # remove lines like this 
nameserver 8.8.8.8 #don't remove

Then restart application and Nginx (optional)

I had the same issue, in my case it was because Google Cloud Compute platform blocks outgoing connections to SMTP servers outside of Google's domain on ports 25, 465, and 587.

To fix this problem we had to connect to a non-standard SMTP port (most API-based mailer platforms support 2525 as well for this reason).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!