RE: [ILUG] Dynamically choosing smtp server

From: Kenn Humborg (kenn at domain bluetree.ie)
Date: Tue 17 Sep 2002 - 10:09:51 IST


> Using sendmail and queuing mail for delivery, in sendmail.cf I have
>
> smarthost smtp.iol.ie
>
> or whatever. I do
>
> sendmail -q
>
> to flush the queue when connected. I want to be able to dynamically
> switch between smtp servers depending on who I'm connected to. Can
> I do something like
>
>
> smarthost smtp.iol.ie
> smarthost smtp.oceanfree.net
>
> and have sendmail use whichever accepts the mail?

Nope. But how about using outgoing-smtp-host.mydomain as the
smarthost and modifying /etc/hosts in /etc/ppp/ip-up.local to
resolve this to the correct IP?

Problem with this is that you need to keep track of the IP
addresses of these servers yourself.

Are you running a DNS server on the dialup box? If so, create
a zone file for some fake domain (say conor-daly.). Then
put a single CNAME record in this zone for outgoing-smtp.conor-daly.
Your ip-up.local script then rewrites this zone file to bump up
the zone serial number and point this CNAME to the correct SMTP
server name. Then it does "service named reload".

Mind you, a simple perl one-liner (which someone else can provide)
that modified sendmail.cf in-place it probably the simplest.
Note that, in a lot of cases, you don't need to restart sendmail
to pick up changes to the .cf file. But to be safe, stick a
"service sendmail reload" in your ip-up.local after modifying
sendmail.cf.

Later,
Kenn



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:18:53 GMT