Setting up root domain correctly for email + website

I’m new to setting up DNS. Here is what I want to achieve: a website on the naked domain, www and subdomains + email on the root domain (eg [email protected])

I already had this working with the DNS setup at my domain registrar:

  • 3 CNAME records for the 2 websites that each point to for hosting on
    • and (the vercel-side config takes care of showing the same website)
  • 2 MX records for using fastmail:
    • points to and

It all worked perfectly and I was able to receive emails sent from google and hotmail but then someone from a custom domain tried to send me an email on [email protected] and it ended up being sent to [email protected] (the vercel webservers).

With googling I managed to understand that having a CNAME record point to for the website at interferes with the fastmail MX record for There was some mention of using a page redirect which my registrar did not offer which is why I switched to cloudflare.

But now I’m not sure what to add to the DNS setup. Currently, I have the MX records as well as the CNAME records set up in cloudflare for and but NOT for the naked domain and the DNS config page is giving me a warning to configure the root domain but I don’t know what exactly to do to avoid the mail issue I had before.

I have also already set up a redirect rule for according to the 1 cheat sheet example on Redirect Rules Cheat Sheet though I’m not sure that will do anything without a CNAME or A record for

I’m currently waiting for Cloudflare to become the nameserver (I have updated the NS records) so I can’t test anything yet.

I’m sure this is explained somewhere but I have spent a few hours searching and did not find a clear answer and my only way of testing is asking that other person to send me a mail since my own gmail account worked fine from the start.

I think I found a hint about the correct solution: Normally an A record is needed for the root domain but cloudflare uses CNAME flattening to convert CNAME into A. The docs say to add a CNAME record that points to cloudflare for the root domain and that will in turn trigger the redirect rule to www. But I can’t find the target to fill in for the CNAME record.

I also found a mention that an A record for the root domain is added automatically once cloudflare has become the nameserver but that has not propagated through the DNS network yet so I can’t confirm that.

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