I'm trying to use multiple smtp IPs without having multiple postfix instances.
So I tried to split smtp using transport_maps and that works ok for local mail destined to foreign destinations. But it breaks the delivery of foreign mail destined to local destinations with the error "mail for example.com loops back to myself". Where's the place place to "plug" the custom service (postfix-smtp-roundrobin.pl)? # main.cf transport_maps = tcp:127.0.0.1:9999 # -------%<---------------------------------- # master.cf smtp unix - - n - - smtp relay unix - - n - - smtp 127.0.0.1:smtp inet n - n - - smtpd 1.1.1.1:smtp inet n - n - - smtpd -o myhostname=mx1.example.com -o smtp_helo_name=mx1.example.com -o smtp_bind_address=1.1.1.1 -o syslog_name=smtpd-mx1 -o smtpd_tls_cert_file=/etc/pki/postfix/mx1.example.com.cert -o smtpd_tls_key_file=/etc/pki/postfix/mx1.example.com.key -o smtp_tls_cert_file=/etc/pki/postfix/mx1.example.com.cert -o smtp_tls_key_file=/etc/pki/postfix/mx1.example.com.key -o smtpd_sasl_local_domain=mx1.example.com 2.2.2.2:smtp inet n - n - - smtpd -o myhostname=mx2.example.com -o smtp_helo_name=mx2.example.com -o smtp_bind_address=2.2.2.2 -o syslog_name=smtpd-mx2 -o smtpd_tls_cert_file=/etc/pki/postfix/mx2.example.com.cert -o smtpd_tls_key_file=/etc/pki/postfix/mx2.example.com.key -o smtp_tls_cert_file=/etc/pki/postfix/mx2.example.com.cert -o smtp_tls_key_file=/etc/pki/postfix/mx2.example.com.key -o smtpd_sasl_local_domain=mx2.example.com # Round-robin outgoing smtp # And the contents of /usr/local/sbin/postfix-smtp-roundrobin.pl # can be found at https://gist.github.com/mvsantos/9786697 # 127.0.0.1:9999 inet n n n - 0 spawn user=nobody argv=/usr/local/sbin/postfix-smtp-roundrobin.pl smtp1 unix - - n - - smtp -o myhostname=mx1.example.com -o smtp_helo_name=mx1.example.com -o smtp_bind_address=1.1.1.1 -o syslog_name=smtp-mx1 smtp2 unix - - n - - smtp -o myhostname=mx2.example.com -o smtp_helo_name=mx2.example.com -o smtp_bind_address=2.2.2.2 -o syslog_name=smtp-mx2 # ------->%---------------------------------- --version-- CentOS release 6.5 Postfix 2.11.0 --Mailbox locking methods-- flock fcntl dotlock --Supported Lookup tables-- btree cidr environ fail hash internal ldap memcache mysql nis pcre proxy regexp socketmap static tcp texthash unix Thanks Marcus