From 4373b0ba7521ed9b007a20d50619949f7ed23577 Mon Sep 17 00:00:00 2001 From: downtownallday Date: Sun, 23 Feb 2025 06:53:22 -0500 Subject: [PATCH] Change Postfix's smtp_address_preference to ipv4 --- setup/mail-postfix.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/setup/mail-postfix.sh b/setup/mail-postfix.sh index 45631ce5..44920403 100755 --- a/setup/mail-postfix.sh +++ b/setup/mail-postfix.sh @@ -71,6 +71,19 @@ tools/editconf.py /etc/postfix/main.cf \ smtpd_banner="\$myhostname ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see https://mailinabox.email/)" \ mydestination=localhost +# Spamhaus blacklists IPv6 addresses at the /64 granularity, so if an +# ISP is assigning addresses to customers at a lower granularity and +# Spamhaus finds just 1 other machine behaving badly in that range, +# the entire range is (unfairly) blacklisted. +# +# Configure Postfix to use IPv4 before IPv6 for outbound mail delivery +# when MX records containing both addresses have equal +# preference. This can help deliver mail in the above scenario because +# Spamhaus has no such range restriction for IPv4. + +tools/editconf.py /etc/postfix/main.cf \ + smtp_address_preference=ipv4 + # Tweak some queue settings: # * Inform users when their e-mail delivery is delayed more than 3 hours (default is not to warn). # * Stop trying to send an undeliverable e-mail after 2 days (instead of 5), and for bounce messages just try for 1 day.