Disable IPV6 for mail only


Is there any way to disable IPv6 for mail only? I have disabled by postfix command but it seems to revert back to all instead of just IPv4 after updates.

Have tried postconf -e inet_protocols=ipv4 and manual edit of postfix/main.cf
I also removed the AAAA record in the dns but it seems to find a way to send when it reverts back to all.

Would be handy to have a switch under the mail to enable / disable IPv6 for mail

I would recommend disabling IPv6 as an all-or-nothing decision. I suggest this because in the absence of an MX record, per RFC 2821 § 5 an implied MX exists against the A and by extension AAAA if no such non-null MX record exists. You’re also creating a desynchronous playground between services; consistency should be your priority.

cpcmd scope:set net.ip6-enabled false will disable IPv6 for all services and all accounts. Once that’s done run EditDomain -c ipinfo6,enabled=0 --all to update DNS records.

If you would like to disable IPv6 for just Postfix, which I’d deem an antipattern, then you would need to do two things:

I’d suggest at that point also disabling IPv6 on Dovecot since they’re strongly related.