Search code examples
azurednsmail-server

Mailserver: using same domain but other hosting


I have a question about setting up my mailserver settings. I have a website on azure, so in my DNS settings at my reseller, i set up tot point domain.com to domain.azurewebsites.net. Website is working fine, so far so good. Now i want to use a mailserver, hosted somewhere else, because azure doesn't provide this out of the box. In my DNS settings i set up the MX record to point to my other hosting where i have a mailserver defined. domain.com MX mail.domain.com mail.domain.com A "ipadress mailserver" When i try to send a mail using my mailcredentials and mail.domain.com as smtp server, all works fine. But i can't receive email messages. Is it possible to set this up if my main domain will point to azure?


Solution

  • Seems like i found a solution. You should not use a CNAME for the root domain as this is also used to resolve the MX record. So just add an A record for domain.com instead of a CNAME and the MX record will be reslved properly. Off course, azure does not recommend an A record because the IP address can change, but this is only when you change plan or disable/enable your website.