Two smarthosts in exim - solved
Hello,
some time ago, I have asked on this list how to switch smarthosts in Exim
back and forth, since I use two ISPs. I didn't want to have two completely
separate config files, since they'd be likely to get out of sync.
I finally figured out how I can do it: using the ${lookup...} expansion. So
far, it seems to be working.
In the smarthost router, I use
route_list = "*
${lookup{smarthost}lsearch{/etc/exim.smarthost}{$value}fail} bydns_a"
(all on one line).
In ip-up.d/exim I have:
#!/bin/sh
if [ -e /etc/exim.smarthosts/$PPP_REMOTE ]; then
cp /etc/exim.smarthosts/$PPP_REMOTE /etc/exim.smarthost
else
cp /etc/exim.smarthosts/Unknown /etc/exim.smarthost
elm -s"unknown smarthost for $PPP_REMOTE" root < /dev/null
fi
# Flush exim queue
if [ -x /usr/sbin/exim ]; then
/usr/sbin/exim -qqf
fi
The files in /etc/exim.smarthosts are all one-line files of the form
smarthost: mail.isp.com
If I need to change something else based on the ISP, I can add another line
to them.
For completeness, I added an ip-down.d/exim that switches back to None.
Jiri
--
<jiri@baum.com.au>
We'll know the future has arrived when every mailer transparently
quotes lines that begin with "From ", but no-one remembers why.
Reply to: