Set up email records
There are three reasons to set up email records for your domain:
- To make sure your domain can receive email.
- To make sure your domain can send and receive email.
- To prevent other email senders from spoofing your domain.
If you only need to receive emails, Cloudflare offers Email Routing for free email forwarding to custom email addresses.
To send and receive emails from your domain, you need:
- An SMTP provider.
- To create two DNS records within Cloudflare.
To route emails through Cloudflare and to your mail server:
-
Get the IP address and MX record details from your SMTP provider (vendor-specific guidelines).
-
Add an
A
orAAAA
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
DNS only API example
-
Add an
MX
record that points to that subdomain.Type Name Mail server TTL MX @
mail.example.com
Auto API example
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.
Refer to Security records to learn how to set up your email security records.