If you have multiple IP addresses available on your iRedMail server, and would like to send from different IP Addresses for different domains, follow the steps below.
This can only be set up on Postfix version>=2.7.x
, because the parameter we need sender_dependent_default_transport_maps
is available in Postfix-2.7 and later releases.
To check your Postfix version run:
# postconf mail_version
Which would return something like: mail_version = 2.10.3
sender_dependent_default_transport_maps
to the end of /etc/postfix/main.cf
like below:sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
/etc/postfix/sdd_transport.pcre
with below content. NOTE: I use domain 'example.com' for testing, it will use transport 'sample-smtp' - see examples./@example\.com$/ sample-smtp:
/etc/postfix/master.cf
like below. Note: you must replace our sample IP address 172.16.244.159
with your IP address.sample-smtp unix - - n - - smtp
-o smtp_bind_address=172.16.244.159
# -o smtp_helo_name=example.com
# -o syslog_name=postfix-example-com
Option smtp_helo_name
and syslog_name
are optional.
After this restart the Postfix Service to apply your changes,
# /etc/init.d/postfix restart
Note: any unmatched domains will continue using the server's primary IP address just as before.
Document published under a CC BY-ND 3.0 license. If you found something wrong, please do contact us to fix it.