I have setup a new mail server which will eventually replace a current mailserver. Now, without changing the MX records to point to the new server, I will be unable to test this mailserver. Is their a way that I can still test that the mailserver is working? I've created a new domain alias (such as test.domain.com) and that is working fine- just wandering if there is any way through some DNS tricks that can trick an email program into sending the email to a different host (such as my new host) than the current email server?

| improve this question | | | | |

There are 3 different methods I can think of to achieve the desired result. (see note at end)

  1. Set up the box either with a different public IP to your real mail server, or even better connected to a firewall/router with a different ip to your mail server. Set up MX records for a different domain pointing to this and configure your mailserver to accept emails for this test domain. This way you can test internally and externally but you will have to use a different domain.

  2. Set up a box where you can specify the mailserver IP rather than it looking up the MX record. Many multi function print/scan devices could do the job, or you could go further and set up something like a postfix box or a server 2003 box with IIS and set it to forward emails for your domain to your test server so you can use a variety of test boxes to send email. This will use your specified IP address for that domain rather than a DNS lookup of the MX record. This will only work internally, unless you have another public IP to send the mails to.

  3. Set up a DNS server - something like Windows Server DNS or djbdns and then create your fake MX records and set the sender to use this machine for DNS. Again this will only work internally unless you have a 2nd public ip, and you will need to either allow your test DNS server to be accessed via VPN/WAN, or you will need to have a remote test DNS server.

Caveat - I haven't tried having both a production and test Exchange box serving the same email domain and on the same windows domain as a test Exchange box - I have a feeling they may not get on together but I'm not certain.

| improve this answer | | | | |
  • I generally use option #3 which is most reliable. – Suyash Jain May 3 '18 at 7:25
  • When testing isolated websites on new hosting, the "hosts" file maps unique domain names to the new IP addresses. Can someone explain why mail servers were not setup to be similarly tested in isolation? When I actually change my mailserver using the hosts file (under Windows, if if matters), emails to the new mailserver just bounce. I forsee email breaking when I switch over the DNS zones! – David Spector Sep 30 '19 at 20:39

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.