Google blocks receipt of IPv6 email sent by OS X Server
If you are using both IPv4 and IPv6 internet connections and your email users are complaining about not receiving email, especially Google email, read on.
I use a Mac Mini running OS X Server to provide email addresses for officers in our civic association. Most of the mail was going through but more and more complaints were coming in claiming non-receipt of email. The mail was not in the recipients spam folder, either.
Postfix on the MacMini would send using either IPv4 or IPv6 connections when forwarding to the recipient email account. Sending SMTP mail on using either IPv4 or IPv6 to test sites works perfectly. Google, for some reason, has decided to refuse IPv6 connections that do not resolve with a rPTR record for sending IPv6 address. Getting a PTR record set for IPv6 isn't always possible and there isn't a good reason why Google needs to be this restrictive. If the email went to Google using the IPv4 route, messages would arrive in the destination mailboxes just fine since the Google rules on mail sent by IPv4 servers are less restrictive.
Two others have written how to overcome this situation on LINUX servers here http://tanguy.ortolo.eu/blog/article109/google-ipv6-smtp-restrictions and here http://christian.skala.me/blog/gmail-why-are-you-doing-this-to-me/#.VHDsUbnkHYs
These solutions work well on OS X Server's implementation of POSTFIX as long as you change the path names to the files. So if you run into this problem on your OS X Server here are steps to force all email sent to gmail.com to use IPv4 and mail to all other domains can use wither IPv4 or IPv6. This is the same process documented in the above links changed to work with the file paths used by POSTFIX in OS X Server
Edit /Library/Server/Mail/Config/postfix/transport using your favorite text editor (I use BBEdit) and add these lines:
# | Limit gmail.com to IPv4 |
gmail.com smtp-ipv4:
Edit /Library/Server/Mail/Config/postfix/master.cf and add these lines:
# | Limit gmail.com to IPv4 |
smtp-ipv4 unix - - - - - smtp -o inet_protocols=ipv4
Using terminal turn the transport file into a database POSTFIX can use:
sudo postmap /Library/Server/Mail/Config/postfix/transport
Edit /Library/Server/Mail/Config/postfix/main.cf and add these lines:
# | Limit gmail.com to IPv4 |
transport_maps = hash:/Library/Server/Mail/Config/postfix/transport
Use terminal to reload POSTFIX so the changes take place:
sudo postfix reload
You should now be able to send email messages consistently to people with whomever@gmail.com addresses and they will always use the IPv4 route while email to other domains will take either IPv4 or IPv6 routes, depending on what is optimally available at the time.