# Cloudflare MX Records

## Set up email records

There are two reasons to set up email records for your domain: to make sure email <mark style="color:blue;">reaches your mail server</mark> and to prevent other email senders from <mark style="color:blue;">spoofing your domain</mark>.

## ​​Add MX records

To route emails to your mail server, you need to <mark style="color:blue;">create two DNS records</mark> within Cloudflare:

1. 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      |

2. An **MX** record that points to that subdomain.

| Type | Name | Mail server      | TTL  |
| ---- | ---- | ---------------- | ---- |
| MX   | @    | mail.example.com | Auto |

### ​​Configure email security records

To set up email security records:

1. Log in to the <mark style="color:blue;">Cloudflare dashboardOpen external link</mark> and select your domain.
2. Go to **DNS**.
3. 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.
