If you use Postfix as a mail server, you may have recently noticed that gmail has stopped receiving your mails. That's because postfix has, over the years, gradually started shifting its defaults from ipv4 to ipv6 as the latter became more accepted.

Unfortunately, gmail's email reputation system for ipv6 is still as mysterious as it was in 2013. You may find that your ipv6 address doesn't have anywhere near the reputation of your old ipv4 address, and your mails being put into the spam bin without notice.

It would be nice if gmail were to produce a statement about sending mail from ipv6; Is reputation linked to entire addresses, or entire /64s? What can I do to mark myself as someone whose mail, absent other indicators of spam, can be trusted somewhat?

I stumbled upon Tanguy Ortolo's advice to add the following configuration to postfix's master.cf file:


smtp4     unix  -       -       -       -       -       smtp -o inet_protocols=ipv4
	  
This installs an outgoing SMTP handler that only speaks ipv4.

And then use a transport map to force outgoing mail to gmail to use this SMTP handler exclusively.

However, as of postfix 3.4, this doesn't seem to work. After a quick search through the manual pages, it turned out that


smtp4     unix  -       -       -       -       -       smtp -o smtp_address_preference=ipv4
	  
This installs an outgoing SMTP handler that only uses ipv6 if there's no alternative.

Does work. With the additional advantage that, should gmail ever disable ipv4 submission entirely (let's hope they've fixed their reputation problem by then) this solution will continue to work. Of course, it's possible to set smtp_address_preference to ipv4 globally; it should be a completely safe option.