Sending email from a specified IP-address in an email domain
From ISPWiki
If your e-mail domain is running Exim and Postfix, you can provide the IP-address that will be used for sending email. Now you can add it for an email domain in ISPmanager Pro.
If you are running newly installed ISPmanager Pro, this function will be set automatically (if you choose Exim is as MTA), or when setting up an SMTP server in the Applications (ISPmanager) module.
For the systems that are already running Exim or Postfix and ISPmanager Pro you need to:
For Exim:
1. create an empty file, such as domainips.
On Debian/Ubuntu:
# touch /etc/exim4/domainips
On FreeBSD:
# touch /usr/local/etc/exim/domainips
2. Provide the path to this file in the ISPmanager configuration file and kill ispmgr:
# echo "path exim-domainips /etc/exim4/domainips" >> /usr/local/ispmgr/etc/ispmgr.conf # killall ispmgr
on FreeBSD:
# echo "path exim-domainips /usr/local/etc/exim/domainips" >> /usr/local/ispmgr/etc/ispmgr.conf # killall ispmgr
3. In Exim (/etc/exim4/exim4.conf.template on Debian/Ubuintu or /usr/local/etc/exim/configure on FreeBSD) locate the followings:
begin transports remote_smtp: driver = smtp local_delivery:
Add "interface = ${extract{1}{;}{${lookup{$sender_address_domain}lsearch{__path_to_domainips__}}}}" into remote_smtp.
On Debian/Ubuntu:
begin transports
remote_smtp:
driver = smtp
interface = ${extract{1}{;}{${lookup{$sender_address_domain}lsearch{/etc/exim4/domainips}}}}
local_delivery:
On FreeBSD:
begin transports
remote_smtp:
driver = smtp
interface = ${extract{1}{;}{${lookup{$sender_address_domain}lsearch{/usr/local/etc/exim/domainips}}}}
local_delivery:
Restart Exim.
Debian/Ubuntu:
# /etc/init.d/exim4 restart
FreeBSD:
# /usr/local/etc/rc.d/exim restart
For Postfix:
1. add the following lines into main.cf
sender_dependent_default_transport_maps = regexp:/etc/postfix/domainips default_transport = smtp:
2. add the line into ispmgr.conf
path postfix_domainips /etc/postfix/domainips
3. check that ispmgr.conf contains the lines
path postfix_main.cf /etc/postfix/main.cf path postfix_master.cf /etc/postfix/master.cf
4. Restart postfix and ispmgr.
# /etc/init.d/postfix restart # killall ispmgr
Once you are done, go to ISPmanager -> E-mail domains (ISPmanager) to choose a required IP-address.
