Set up email records
There are two reasons to set up email records for your domain: to make sure email reaches your mail server and to prevent other email senders from spoofing your domain.
Add MX records
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
Prevent domain spoofing
There are several DNS mechanisms to prevent others from sending emails on behalf of your domain. These all work as TXT records that need to be added on your domain:
- Sender Policy Framework (SPF): List authorized IP addresses and domains that can send email on behalf of your domain.
- DomainKeys Identified Mail (DKIM): Ensure email authenticity by cryptographically signing emails.
- Domain-based Message Authentication Reporting and Conformance (DMARC): Receive aggregate reports about your email traffic and provide clear instructions for how email receivers should treat non-conforming emails.
Configure email security records
To set up email security records:
- Log in to the Cloudflare dashboard 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.