Using Cloudflare with cpanel and send emails from [email protected] domain but not [email protected]

I could successfully add DNS records at Cloudflare DNS table.
As my NS is of Cloudflare, It was not possible to control the MX records by my CPanel directly, so I needed to

  • firstly create a subdomain mail.root.com and point it to the CPanel server ip.
  • And then manage use the cpanel DNS panel to create email users.

My problem is that I can only create email users named:
[email protected]
Is there a way to use CPanel and Cloudflare and create users @rootdomain.com directly?

May I ask have you got NS type of DNS records at the DNS tab of Cloudflare dashboard for your domain name, or rather referring to the domain nameservers?

Correct.
Add an A mail and make sure it’s :grey: (DNS-only) as follows and also make sure your MX is pointed to that unproxied mail.domain.com hostname:

I have to admit, I never used [email protected] format, rather [email protected] for an mailbox user.

Yes.

Maybe the issue here is, your origin host / server is using domain.com instead of sub.domain.com for it’s hostname / rPTR record?
And the root domain (naked) is proxied :orange:?

My practice is to use separate e-mail provider, like for example Namecheap e-mail (one mailbox with up to 10 aliases) for the origin host / server where I host files.

Therefore, each of the domain names I add using, be it cPanel, ISPConfig, Plesk, has it’s own mail sub-domain used to send e-mails.

1 Like

Below as images of both cloudflare and cpanel dns tables

Cloudflare
image


cpanel:

image

image

Sorry i was not allowed to post all images in one post

My name servers are of Cloudflare for the root domain (mydomain.com)
In Cloudflare I added: an A Record for mail.mydomain.com pointing to the cpanel IP.
All my mail/mx records are not proxied
I added photos in the other replies for your to kindly check them.

Do you mean that they receive [email protected] but on the server of the mail server pointed as “mail.mydomain.com”? Because this is what I need.

Most people use the @rootdomain mail format, and cPanel supports this. Your DNS records here are properly configured for that domain. If your host doesn’t let you create a @rootdomain address, you will have to ask them why.

Not that. Standard configuration is to have a ‘mail’ hostname so email for @rootdomain follow the MX record and are delivered to the ‘mail’ server.

1 Like

I could figure it out after watching a video showing an easy trick.
The steps are just leading me to have the correct DNS records without any effort as below:

  • Remove the website domain from Cloudflare
  • Change the Name servers to the CPanel ns again.
  • After NS is propagated, and everything works well including emailing, go to Cloudflare and add the website again.
  • Cloudflare will detect and copy all the correct DNS records from the CPanel DNS table.
  • Disable proxy (Orange cloud) from DNS records related to mail and similar services.
  • Change the name servers to Cloudflare’s NSs.
  • once it is propagated, everything will work well including sending and receiving emails using emails @root.com domain
    All Credit goes to this guy’s Video
    2021 cPanel Domain on Cloudflare, How to set it up and still use Email - YouTube

I think we only need to now the proper mx records for cpanel.

It gets a little complicated when you are hosting your own server and already uses Cloudflare.

Your suggestion assumes that website is hosted on a service that already uses cpanel

Yes, the initial question was about the cPanel mail server, while having your own mail server on your VPS, is another complication that I don’t know of.