For organizations operating mail infrastructure in restrictive networks or corporate subnets with unreliable direct port 25 connectivity, combining HAProxy as an SMTP proxy relay with Postfix's smtp_fallback_relay directive guarantees reliable email delivery without dropped messages.
Flow: Primary MTA → Direct MX Delivery Failure →
smtp_fallback_relay → HAProxy Relay VPS → Destination MX
1. HAProxy TCP Relay Configuration (haproxy.cfg)
listen smtp-relay
bind *:2525
mode tcp
option tcplog
timeout connect 5s
timeout client 1m
timeout server 1m
server mta-out 10.0.0.1:25 check
2. Postfix Fallback Configuration (/etc/postfix/main.cf)
Instruct Postfix to attempt direct MX delivery first, but automatically route through the HAProxy relay if destination mail servers are unreachable:
# Automatic fallback routing to HAProxy relay on port 2525
smtp_fallback_relay = [relay.example.com]:2525
No comments:
Post a Comment