Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a multi-tenant email relay set up that has a transport map file that looks like this:

In the event is down, email for will be held by the postfix server until starts responding again. However we have a customer who has a backup DSL line on their site, an their email server is also available over this. How can I tell the transport to failover to a different host if the first is unavailable?

Clarification I think there is some confusion over the purpose of this setup. This postfix server is an inbound mail relay for clients who do not have AV and Spam protection on site. It is one of a pair, which are configured as the 2 MX records for these customers. They receive and clean email before forwarding it on to their local mail servers, as well as acting as a buffer in case of an outage on their end. These customers don't generally have multiple on site mail servers, they are too small hence this service. What they do often have though is a secondary connection, eg fibre and DSL, so I'd like to be able to direct the onward SMTP to their second connection should the first be unreachable.

share|improve this question

The first question is WHY.

If your DNS is properly set up, relaying mail for via is automatic; this is how it's supposed to work.

WHY are you circumventing the normal flow of email ?

If the answer is "because we cannot use DNS", then there should be no hostnames in your transport_maps at all; use bracketed IP literals: smtp:[] smtp:[]

As to the failover part: provided the list of relay domains is not large, you could set name resolution to "native" and put multiple IPs in the /etc/hosts file:
share|improve this answer
I think you are missing the purpose of the setup as I wasn't clear. Please see clarification above. – SimonJGreen Nov 16 '12 at 13:22

You can add a failover server declaring a new MX DNS record pointing to the failover IP (I guess the server external IP will change if it's NATed behind a DSL line).

The new MX record will have a lower weight value that the default MX record, which will prevent from using it when the default/main server is reachable

share|improve this answer
Problem is using the smtp: transport method we send mail direct to the host, no MX lookup is performed. – SimonJGreen Nov 15 '12 at 19:58
Maybe I misunderstood your setup, but by default Postfix transport will perform a MX lookup, unless your next hop (smtp:your_host.tld) has brackets (smtp:[your_host.tld]). You can check the "EXAMPLES" section of the Postfix manual page: – mbarthelemy Nov 16 '12 at 9:37
Backup MXen are nothing but spam attractors these days. You're assuming all clients implement the rules properly; many do not. – adaptr Nov 16 '12 at 12:59
I think you are missing the purpose of the setup as I wasn't clear. Please see clarification above. – SimonJGreen Nov 16 '12 at 13:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.