My mail server is the same as the root server. How can I proxy website without losing email access?

Hello all,

I’ve followed guides and read community boards etc, but a bit stuck here. My email server is the same as the URL server. How can I both proxy my site without losing email functionality?

Say my website is https:// mydomain .com (including www. mydomain .com) and the email server is mydomain .com (and NOT mail. mydomain. com, which would make everything easier).

So, I’ve set my MX record to point to root, and an A record to point to the correct URL.
When I proxy the A record website is proxied but email won’t work, and when I unproxy the A record, vice versa.

Is it possible to proxy https:// mydomain. com and yet get access to emails at root folder, such as [email protected] mydomain .com? I would rather not have to create a new email server (e.g., [email protected] mail.mydomain. com)

Sorry for the long question!

Changing the hostname for your MX records and for connecting to with email clients will not change the email addresses. It would only change from [email protected] to [email protected] if you change the name instead of the content of the MX record.

1 Like

Here is an example from a recent thread with the same scenario that you can use as a basis for your configuration. Obviously, you will want to substitute your domain and IP.

Thanks for quick response.
I am not changing the name. Instead, I am using root and this works fine.
If I understand correctly, the content is changed to whatever i put as the mail server. But this is not up to me to choose, right? The issue is that the one that I am given by my host is mydomain. com and not mail . mydomain . com (or similar subdomain), which all the scenarios and guides etc are portraying).

Mail shouldn’t be set up this way, but if you have no control over that, it’s easy to work around.

Your root domain has an A record pointing to some IP address. Create another A record for mail.mydomain.com pointing to the same IP address. Make your MX record point to that new entry, and use that one in your email client. Set the root domain to proxied and the mail entry to DNS-only.

What @i40west and I are saying is that it doesn’t matter what your host provided you as the name. Your email clients and other mail servers do not connect by name. They connect to the IP that the name resolves to. In order to have working email and keep your apex domain :orange: proxied through Cloudflare, all you need to do is to create another entry in your DNS with the name that you want to use to connect to your email.

You could call it cliff-clavin if you want, and as long as it points :grey: to the right IP and is in your MX record, it will work. And now I’m a little bit sadder knowing that cliff-clavin isn’t the MX for cheers dot com. :beers:

1 Like

Dear both. You rock!
All working well now. I needed to delete another MX record which was taking priority.
Thanks for your help.

And to epic.network… thanks for putting a smile on my face this morning (in Switzerland). NORM!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.