Q0317

Nigel Metheringham edited this page Nov 29, 2012 · 2 revisions
Clone this wiki locally

Q0317

Question

What I'd like to do is have alternative smart hosts, where the one to be used is determined by which ISP I'm connected to.

Answer

The simplest way to do this is to arrange for the name of the smart host du jour to be placed in a file when you connect, say /etc/smarthost. Then you can read this file from a manualroute router like this:

smarthost:
  driver = manualroute
  transport = remote_smtp
  route_list = * ${readfile{/etc/smarthost}{}}

The second argument of the readfile item is a string that replaces any newline characters in the file (in this case, with nothing). By keeping the data out of the main configuration file, you avoid having to HUP the daemon when it changes.

Answer Two

To send all none local domains with an alternative server, you can use the following setting. Add this section as first router.

smarthost:
   driver = manualroute
   domains = ! +local_domains
   transport = remote_smtp
   route_list = * you.alternative.server.com