Hans Ekbrand
2015-05-29 12:02:17 UTC
I want to use different smart hosts depending on the sender address.
There is a old document that describes a solution, but it appears to
be for exim3, or at least not for exim4 with split-config which I use
http://www.volker-wegert.de/en/node/35
However, I used the concept outlined there and tried to apply it to
exim4 with split config.
1. Create a file /etc/exim/my.smarthosts with the following content.
***@bar.com: smarthost="smtp.bar.com" auth_name="my.username" auth_pass="some password"
***@foo.com: smarthost="smtpgw.foo.com" auth_name="my.username" auth_pass="another password"
2. Changed the smarthost field in /etc/exim4/update-exim4.conf.conf
#dc_smarthost='smtp.gmail.com'
dc_smarthost='${extract{smart_host}{${lookup{$sender_address}lsearch{/etc/exim4/my.smarthosts}{$value}fail}}}'
3. reload exim with new configuration
sudo update-exim4.conf
sudo service exim4 reload
When I tried to send a mail, I got:
2015-05-29 12:47:52 [22620] 1YyHpQ-0005sq-AT <= ***@gu.se U=hans P=local S=923 M8S=0 id=***@hans from <***@gu.se> for ***@gmail.com
2015-05-29 12:47:52 [22622] 1YyHpQ-0005sq-AT error in smarthost router: no host(s) specified for domain *
2015-05-29 12:47:52 [22622] 1YyHpQ-0005sq-AT == ***@gmail.com R=smarthost defer (-1): error in smarthost router: no host(s) specified for domain *
Which brings me to my question to the list:
What is needed to make exim use different smart hosts for different
sender addresses?
There is a old document that describes a solution, but it appears to
be for exim3, or at least not for exim4 with split-config which I use
http://www.volker-wegert.de/en/node/35
However, I used the concept outlined there and tried to apply it to
exim4 with split config.
1. Create a file /etc/exim/my.smarthosts with the following content.
***@bar.com: smarthost="smtp.bar.com" auth_name="my.username" auth_pass="some password"
***@foo.com: smarthost="smtpgw.foo.com" auth_name="my.username" auth_pass="another password"
2. Changed the smarthost field in /etc/exim4/update-exim4.conf.conf
#dc_smarthost='smtp.gmail.com'
dc_smarthost='${extract{smart_host}{${lookup{$sender_address}lsearch{/etc/exim4/my.smarthosts}{$value}fail}}}'
3. reload exim with new configuration
sudo update-exim4.conf
sudo service exim4 reload
When I tried to send a mail, I got:
2015-05-29 12:47:52 [22620] 1YyHpQ-0005sq-AT <= ***@gu.se U=hans P=local S=923 M8S=0 id=***@hans from <***@gu.se> for ***@gmail.com
2015-05-29 12:47:52 [22622] 1YyHpQ-0005sq-AT error in smarthost router: no host(s) specified for domain *
2015-05-29 12:47:52 [22622] 1YyHpQ-0005sq-AT == ***@gmail.com R=smarthost defer (-1): error in smarthost router: no host(s) specified for domain *
Which brings me to my question to the list:
What is needed to make exim use different smart hosts for different
sender addresses?
--
Note that I use Debian version 8.0
Linux hans 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) i686 GNU/Linux
Note that I use Debian version 8.0
Linux hans 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) i686 GNU/Linux