multiple smart hosts

multiple smart hosts

Post by Mike Watt » Tue, 22 Jul 2003 14:11:11

hi there,

i have two sendmail servers in my dmz, and one in an internal network.
currently i have the internal server set to forward all mail to one of the
dmz servers, which is fine for as long as that server is up. i would like to
configure the sendmail on the internal network to use multiple smart hosts,
ie, if the first sendmail server on the dmz fails, try the other one.

is this possible at all, without hacking sendmail too much?

multiple smart hosts

Post by Andrzej Ad » Tue, 22 Jul 2003 16:10:50


All defaults smtp based mailers accept ":" separated "fallback list".

Andrzej [pl>en: Andrew] Adam Filip
I am proud I am not a new model bushman. *Random Epigram* :
A lizard on a cushion will still seek leaves.
-- Russian Proverb


multiple smart hosts

Post by dholmes00 » Fri, 03 Aug 2007 00:39:54

OK - so I have an application running on a Linux box. That application
calls sendmail and generates an email message. I want ALL email
messages to go to my email gateway for routing to their ultimate
destination. A Smart Host entry in the should do this,

Here's the thing - suppose that Smart Host goes down for whatever
reason. As it happens, I have 4 email gateways handling outgoing SMTP.
I want my application to be able to generate mail, and if one of those
4 gateways is down, I want it to automatically use a second one, and
if that one is down, automatically use the 3rd, and so on.

Can sendmail do that? How do I configure that?


multiple smart hosts

Post by Grant Tayl » Fri, 03 Aug 2007 00:49:58

I do not think that Sendmail can do this its self. However in my
opinion, short of having a list of servers to try, this is really out
side of the scope of what Sendmail should do. In my opinion, your
question would be better answered by a (redundant) load balancer in
front of your email gateways.

Granted, it would probably be nice if Sendmail could do something akin
to MX lookups to build a list of Smart Hosts to try in sequence and / or
randomly. However I think this is primarily still out side the scope
of Sendmail.

Grant. . . .

multiple smart hosts

Post by Andrzej Ad » Fri, 03 Aug 2007 00:54:41


It is `mailer specific'. It will work for all 5 smtp mailers.

Using `internal MX record' as `smart host' may be a better choice giving
a (simple) load balancing option.

[pl>en: Andrew] Andrzej Adam Filip : XXXX@XXXXX.COM : XXXX@XXXXX.COM
A car with only one working headlight.
-- "Sniglets", Rich Hall & Friends

multiple smart hosts

Post by dholmes00 » Fri, 03 Aug 2007 01:03:35

Thanks Grant for the reply. You mentioned "having a list of servers to
try" - Is this a viable option? How would it be configured? It is
unlikely that I can add another device to the environment unless it is
truly the only way to ensure reliability. The gateways seldom fail,
but I need to assure the application owners that they would not have
to manually re-configure sendmail on thier Linux box if/when we ever
have a gateway outage.

multiple smart hosts

Post by John » Fri, 03 Aug 2007 01:12:58

You can just specify multiple smarthosts, separated by
colons, eg [a.b.c.d]:[e.f.g.h] and it should automatically
failover to using e.f.g.h when a.b.c.d is down.


multiple smart hosts

Post by Grant Tayl » Fri, 03 Aug 2007 01:43:35

I was mentioning that as a desired feature request type thing, not that
this feature actually presently exists.

One thing that you might be able to do would be to set up a DNS service
name with a short time to live that resolves to your multiple gateways.
Then if there is an outage, update DNS and tell your clients and / or
restart their clients depending on it. I know that this is not optimal,
but it is one way to provide an abstraction layer that can fairly easily
be utilized with out requiring clients to reconfigure their client(s).

Grant. . . .

multiple smart hosts

Post by zoot » Fri, 03 Aug 2007 20:37:07

You can, if you have any control on your DNS, have entries like:
in your domain:
MX 10
MX 10 blabla2,com
MX 10
in your you need:

you can also have (still in DNS ) IN A 123.456.78.12 234.456.23.44. etc..
and in your you need:

as mentioned before you can also have entry like
But verfy the Timeout series for having that to work.

O Timeout.connect=5s


multiple smart hosts

Post by Grant Tayl » Fri, 03 Aug 2007 23:59:02


I think that DNS will provide a nice layer of abstraction that could be
used to your advantage as far as allowing you to add or remove servers
from the list with out having to have customers update their configs.
Also, you could use DNS with other MTAs.

However if things are going to be extremely static, say for multiple
years, the simple config in the cf / mc file would be easier to
implement one time and walk away from.

In short it the abstraction layer worth the extra effort or not. In my
opinion, yes it is.

Grant. . . .

multiple smart hosts

Post by zoot » Sat, 04 Aug 2007 16:17:36

Of cause it would be much better, and safer to make all the changes in
the file. I mentioned the sendmail/ files because it's
faster to modify and can be immediatly tested, but please do youself a
favor and apply the changes also in your .mc file so that you can
easely apply the same configuration into futre sendmail releases.


multiple smart hosts

Post by srevila » Sat, 11 Aug 2007 12:22:05

> Here's the thing - suppose that Smart Host goes down for whatever

Aside from colon-separated smart-hosts, DNS round robin (DNS-RR) is
also something to consider. Although it accomplishes a slightly
different goal that what you stated.

Suppose your four servers had ip addresses numbered - You'd set up A records IN A IN A IN A IN A

and use the smart host. Your resolver will
round-robin (equal weighting) through the A records with successive
dns lookups.

Depending on the number of machines feeding the gateways, this can
configuration maintenance easier. Suppose you add another gateway,
and you have a hundred application servers that send mail; all you
need to do is add an A record (as opposed to changing each application

The one thing DNS RR doesn't give is automatic failover. But in
practice, I've found it pretty easy to bring up the failed gateways ip
address on one of the surviving gateways. If you're monitoring your
mail servers (and you should be :), then you should find out about
gateway failures in reasonably short order.

As another poster mentioned, hardware load balancers (LBs) will give
you both load-balancing and instant failover. The only disadvantage
to hardware LBs is that they make it more difficult to debug delivery
issues. With DNS-RR the application-server sendmail will log the ip
of the smarthost is used (in the relay= attribute), so it's easy to
trace messages from one machine to another. With a hardware LB,
all of your appliation servers will log the LB's IP address -- you
have to figure out the delivery route from there.