FAQ / Routing to remote hosts / Q0317
| /Q0301 /Q0302 /Q0303 /Q0304 /Q0305 /Q0306 /Q0307 /Q0308 /Q0309 /Q0310 /Q0311 /Q0312 /Q0313 /Q0314 /Q0315 /Q0316 /Q0317 /Q0318 /Q0319 /Q0320 /Q0321 /Q0322 |
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
| /Q0301 /Q0302 /Q0303 /Q0304 /Q0305 /Q0306 /Q0307 /Q0308 /Q0309 /Q0310 /Q0311 /Q0312 /Q0313 /Q0314 /Q0315 /Q0316 /Q0317 /Q0318 /Q0319 /Q0320 /Q0321 /Q0322 |
FAQ / Routing to remote hosts / Q0317
