I am trying to create a CNAME record in DNS that points to our internal SMTP servers. The purpose of this record is to give it to our app developers so they can use it to find an SMTP server when they need to send e-mail from one of their apps. We have several offices and I always want the app to connect to the SMTP server in the same office that the app is running in.
So for example, assuming the CNAME record is smtp-out.company.com, if the app is running in Office 1, I would want the CNAME record to point to office1-smtp.company.com and if the app is running in Office 2, it should point to office2-smtp.company.com.
I do this both for performance and availability reasons. Sometimes the link between offices might be temporarily unavailable, so in that case if an app in Office 1 tries to connect to the SMTP server in Office 2, it would fail.
Essentially what I want are DNS "views" where the response is determined by the IP address of the client. It doesn't seem like MS DNS supports this, but I'm curious if there are any workarounds as I'm sure this is a fairly common use case.
Our active directory is segmented into different sites which align with our different offices, so I could determine responses either by IP address directly, or by associated AD site.