To set up MX records for your domain in Cloudflare, follow these steps. It's worth noting that there are two main reasons for setting up email records for your domain. Firstly, to ensure email delivery to your mail server, and secondly, to prevent other senders from spoofing your domain.
ββAdd MX records
The setup of email routes can seem challenging. Luckily, changing your DNS records in an organized fashion in Cloudflare allows for successful message delivery from one mail server to another.
To route emails to your mail server, you need to create two DNS records within Cloudflare:
An A or AAAA record for your mail subdomain that points to the IP address of your mail server.
Type
Name
IPv4 address
Proxy status
A
mail
192.0.2.1
Proxied
An MX record that points to that subdomain.
Type
Name
Mail server
TTL
MX
@
mail.example.com
Auto
ββConfigure email security records
To configure email security records for your domain:
Log in to the Cloudflare dashboard
Open external link, and select your domain.
Go to DNS.
For Email Security, click Configure.
If your domain sends email, use the available options to set up SPF, DKIM, and DMARC records.
If your domain does not send email, use the Your domain is not used to send email section to set up restrictive email records.
It's important to configure your email security records to protect your domain from spam and phishing attacks, and to ensure the deliverability and authenticity of your email communications.