How to disable Sendmail expansion of CNAMEs for a particular domain but not globally

cname-recorddomain-name-systemsendmail

I have an issue due to "split DNS vision" where email is generated at a host and sent via a smarthost (relay) to an external system out of my control (business partner).

The generating server has access to the remote domain's internal DNS and do not see an MX record for the particular domain name (example.com), but resolves a CNAME instead (example.com. CNAME sub.example.com.), resolves an MX record listed for the CNAME target (sub.example.com. IN MX 10 mail.sub.example.com.), and passes the email on to the smarthost.

The smarthost which has the "external" view of the remote system's DNS zone where example.com does have a MX record (example.com. IN MX 10 mail.example.com.) tries to deliver the email by looking for the MX for sub.example.com, fails and rejects the email.

  • The business partner could publish a MX record in his internal DNS view for example.com, so my server won't do the CNAME expansion, and passing the mails to the smarthost without changing user@example.com to user@sub.example.com.

  • I could configure the generating sendmail to not do CNAME expansion by setting
    confDONT_EXPAND_CNAMES (sendmail.org docs), but this might have unforeseen effects for other domains.

    Is there a way to do this for only example.com emails?

Best Answer

You can use LOCAL_NET_CONFIG

LOCAL_NET_CONFIG
R$+ <@ sub . example . com . > $*      $#smtp $@ [ smart.host.name ] $: $1 < @ example.com . > $2
Related Topic