Here's the short version: I'd like to add some sort of record in DNS Manager such that all SMTP messages sent to an arbitrary internal static IP address get sent instead to the URL smtp.office365.com . Is this possible?

Longer version: We have legacy software that will send out SMTP messages, but not to a URL; it will only work to send to an IP address. We currently have a static SMTP server with our ISP, but we are looking at moving away from that ISP and the new ISP does not offer the SMTP service (according to the techs I am working with).

We need to try to find a way to send out SMTP messages to Office365 servers since we use them for our hosted email, but their SMTP services only use a URL (smtp.office365.com), not a single IP address.

Now, we could just try to choose the IP address that that URL resolves to, but of course if they change it, we'd have to realize that (most likely by not receiving our email alerts that the legacy system sends out) and follow suit.

Is it possible to trick our legacy system by using our DNS manager to host a record that will redirect all traffic sent to a static, internal IP address and forward it to the smtp.office365.com URL?

I tried to add a ptr record in the reverse lookup zone for that arbitrary, unused, static IP address, and I added it in the zone that hosts the internal IP address label, but that created a very long ptr record that was not correct (ex: if the static IP I chose was A.B.C.D, the FQDN in that PTR record ended up looking like A.B.C.D.C.B.A.in-addr.arpa. ).

Edit: If not DNS, what about our firewall? We use a SonicWALL NSA device.


You cannot alias an IP Address in DNS (in your case the legacy app does no dns lookup at all, otherwise it would accept hostnames)

But normally you should always be able to specify a hostname instead of IP Address when specifying the SMTP Smarthost. It is just not practical any other way.

Are you sure you cannot specify the name? You talked about URL, but you won’t use URLs in most smtp settings.

If this is an appliance/device you might need to enable and configure DNS resolution before you can specify addresses as hostnames.

In some firewalls you could add Destination-NAT to redirect connections to an Ip to another one, some firewalls even allow to specify hostnames there - however this is more than ugly.

You can take one of the currently valid IPs, enter into the settings and hope they seldomly change. You can even run an alert script which checks every few minutes if the IP is still valid and reachable.

If you have multiple of „smart“ devices and legacy applications you can set up an internal mail forwarder which has a fixed internal IP and forwards to smtp.office365.com with proper dynamic resolving. This has the additional advantage that you can properly configure authentication and TLS. This will also reduce the numbers of connections to open in the firewall (but make sure all send either with the same sender or all are alllowed behind the mailbox login for this relay service)


smtp.office365.com is not a URL. It's a FQDN (fully qualified domain name).

What you want to achieve can't be achieved with a reverse DNS lookup record (PTR record). If your email server can't use the FQDN than you'll have to use one of the ip addresses that smtp.office365.com resolves to and you'll have to monitor your outbound email queue to make sure outbound email doesn't queue up in the event that the chosen ip address is unavailable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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