> On Sep 29, 2017, at 12:45 PM, Noel Jones <njo...@megan.vbhcs.org> wrote:
> 
>> I send my emails via different gateways based on my transport file. Many
>> domains, however, use the same email providers, such as outlook or
>> gmail. Is there a way to check the MX records before the email is sent
>> and transport it using a specific gateway?
> 
> Sorry, no easy way to do this.

Very much correct, though creative multi-instance + custom DNS hacks are
possible if the number of target domains whose MX hosts one wants to
special-case is limited to O(10) or less.  With enough determination
and care, one can cause the MX hosts in question to resolve in DNS to
distinct loopback addresses where another Postfix instance receives
just the traffic for the provider in question.  This requires the
"special mail" to be diverted to a second Postfix instance on the
same machine, and that instance then delivers the mail on to the
real MX hosts.  The two instances need different DNS views, so for
that chroot might actually be needed for smtp(8), with a different
/etc/resolv.conf inside at least one of the jails.

Sadly, the legacy res_init() does not provide a means to explicitly
set the namerver.  This is possible with res_ninit() which is now
available on most current systems, but Postfix does not yet have
support for this non-universal DNS library feature.

-- 
        Viktor.

Reply via email to