From d3a483c40309b480f1e185bfdc97642612984a27 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 21 Mar 2026 21:24:57 +0000 Subject: [PATCH] feat(postfix): prefer IPv4 in SMTP client --- cmdeploy/src/cmdeploy/postfix/main.cf.j2 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 index 1390456c..9a9ca20b 100644 --- a/cmdeploy/src/cmdeploy/postfix/main.cf.j2 +++ b/cmdeploy/src/cmdeploy/postfix/main.cf.j2 @@ -88,6 +88,22 @@ inet_protocols = ipv4 inet_protocols = all {% endif %} +# Postfix does not try IPv4 and IPv6 connections +# concurrently as of version 3.7.11. +# +# When relay has both A (IPv4) and AAAA (IPv6) records, +# but broken IPv6 connectivity, +# every second message is delayed by the connection timeout +# +# which defaults to 30 seconds. Reducing timeouts is not a solution +# as this will result in a failure to connect to slow servers. +# +# As a workaround we always prefer IPv4 when it is available. +# +# The setting is documented at +# +smtp_address_preference=ipv4 + virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_mailbox_domains = {{ config.mail_domain }} lmtp_header_checks = regexp:/etc/postfix/lmtp_header_cleanup