Skip to Content
DNSGeneral information

Email DNS records

For your domain to receive email, and for other mail servers to trust your messages rather than rejecting them or putting them in spam, your domain needs four types of records:

  • MX: specifies the server that receives your domain's email.
  • SPF: specifies the servers allowed to send on behalf of your domain.
  • DKIM: adds a digital signature to your messages proving they haven't been altered and really come from your domain.
  • DMARC: tells receiving servers what to do with a message that fails the SPF and DKIM checks, and where to send reports.

You add these records wherever your domain's records are managed, that is, with whoever its nameservers point to. See How to manage DNS records if you're not sure.

Case 1: email on shared hosting (cPanel)

If your domain uses the hosting nameservers, cPanel usually creates the MX, SPF and DKIM records automatically. To check them and fix anything missing:

Sign in to cPanel and open Email Deliverability from the Email section. This interface is also covered in Email accounts.

Review your domain's status. If there's a problem with DKIM or SPF, click Manage next to the domain, then Repair or Install the suggested record.

If your domain uses another provider's nameservers, cPanel can't edit the records itself. Copy the suggested values shown in the interface and add them manually with that provider.

Then add a DMARC record as described in its section below, from the Zone Editor, which offers a DMARC type with a ready-made form.

Case 2: a mail server on a VPS

If you run your own mail server on a VPS, you need the following in addition to DNS records:

Then add the following wherever your domain's records are managed (replacing the values with your own):

  • A for the name mail, pointing to your server's address, such as 203.0.113.10.
  • MX for the domain (@), pointing to mail.example.com with priority 10.
  • TXT for the SPF record, such as: v=spf1 mx a:mail.example.com ~all
  • TXT for the DKIM record, with the name and value generated by the mail software on your server (such as default._domainkey).
  • TXT for the DMARC record, as described in the next section.

Case 3: an external email provider

If your domain's email is with an external email provider, that provider gives you the correct values for the MX, SPF and DKIM records. Add them as they are wherever your domain's records are managed, and delete any old MX records pointing to another server; otherwise, your incoming email will be split between the two servers.

The SPF record in detail

The SPF record is a TXT record on the domain itself (@) that starts with v=spf1, followed by what's allowed to send, and ends with a rule for everything else:

  • mx: the servers listed in the MX records.
  • a: the domain's own address.
  • ip4:203.0.113.10: a specific IP address.
  • include:…: allows an external provider, using the value it gives you.
  • ~all: messages from any other servers are treated with suspicion (the safe option to start with), while -all rejects them.
Only one SPF record

Each domain must have only one SPF record. If you send from more than one source (your hosting and a newsletter provider, for example), combine them into a single record, such as: v=spf1 mx include:spf.example.net ~all. Having two records makes the SPF check fail.

The DMARC record in detail

The DMARC record is a TXT record with the name _dmarc. Start with a monitoring policy that doesn't affect whether your email is delivered:

v=DMARC1; p=none; rua=mailto:[email protected]
  • p=none: no action, with reports sent to the address in rua. Suitable to start with.
  • p=quarantine: put non-compliant messages in spam.
  • p=reject: reject non-compliant messages.

After a few weeks of clean reports, once you're sure all your legitimate messages pass SPF and DKIM, gradually raise the policy to quarantine and then reject.

Checking the records

dig MX example.com +short
dig TXT example.com +short
dig TXT _dmarc.example.com +short

You can also send a test message to a mailbox at a major email provider and open "Show original", where you'll find the SPF, DKIM and DMARC result for each message (pass or fail).

Frequently asked questions

How is this guide?

On this page