What's the best way to automatically swap smart hosts (sendmail)?

Bill Freeman f at ke1g.mv.com
Tue Jul 1 09:31:28 EDT 2003


	Sometimes my laptop is home, connected to the cable modem.  At
these times I need my sendmail smart host set to smtp.comcast.net since
my dial up ISP's outgoing mail server (rightly so) is not an open relay.
(I suppose that a VPN tunnel is a possibility here.)

	Sometimes I'm away from home (work, friend's house), and have
to dial up to connect.  At these times I want my sendmail smart host
set to mail.mv.net since (I assume) my cable provider's outgoing mail
server is not an open relay.

	I could fiddle with the RH scripts that are run when the LAN
connection comes up or goes down to link /etc/mail/sendmail.cf to one
of two alternatives.  (Or, alternatively, and probably better, swap
when PPP comes up or goes down, since I may have an ethernet
connection to a non-internet-routed LAN at times.)

	But I feel that it would be less messy if sendmail could
accept a list of smart hosts, using the first if it could connect to
it, trying the second if not, etc., and, finally, as normal, spooling
the mail if it couldn't reach any of the smart hosts.  I don't see
anything like this in the O'Reilly book (though mine, a second
edition, is perhaps somewhat old).

	An alternative might be some sort of local DNS hack, in which,
for example, some dummy FQDN that I specify as the smart host gets
translated into smtp.comcast.net if smtp.comcast.net is reachable, and
mail.mv.net otherwise.  That's probably getting pretty messy again,
especially since I don't currently run a DNS server locally.

	Can anyone think of any cool ways to do this?

							Bill




More information about the gnhlug-discuss mailing list