No Connection over IPv6 to Gmail servers
Every email sent to gmail server adds two lines to my smtp_sender.log:
Cannot connect to 2404:6800:4003:c00::1b:25 (ASPMX.L.GOOGLE.COM) (Net::OpenTimeout: execution expired) Connected to 74.125.200.27:25 (ASPMX.L.GOOGLE.COM)
And then the message is sent as usual. Can you please explain why this could be the case? I am using IPv6 on a DO droplet.
Can you confirm that IPv6 is working properly on your droplet? You can use ping6 and traceroute6 as suggested here https://docs.menandmice.com/display/MM/How+to+test+IPv6+connectivity
I am able to ping the server using IPv6. Also did a traceroute, and all seems fine. Could this be because DO does not allow IPv6 SMTP? Just found an article here
That would probably explain it, if you could confirm with DigitalOcean support, that would be a good reference here. I believe we use IPv6 on AWS with no issue and I had other issues with IPv6 on DO so kept to IPv4 for now.
I couldn't figure out how to force IPv4 after a quick search of the wiki and issues. Can you please point me in the right direction?
AFAIK the only real way to do this is to remove the IPv6 address from the networking configuration so your entire server is not aware of it.
I don't think Postal has a toggle for it.
@willpower232 Thanks, that did the trick! Closing the issue.
To Summarize, DigitalOcean does not support SMTP over IPv6. To disable the same, either choose and IPv4 droplet or disable IPv6 for your machine from the relevant conf file. (/etc/sysctl.conf on ubuntu).
For me, doing the following solved the issue on 22.04.5 LTS (Jammy Jellyfish):
sudo nano /etc/sysctl.conf
Adding these lines at the end of the file:
# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Apply the changes:
sudo sysctl -p