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:
- Open the outgoing mail ports by adding the free Mail-ready add-on.
- A PTR record that matches the server name, which is set automatically on our servers as described in Server name and reverse record (PTR).
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 as203.0.113.10. - MX for the domain (
@), pointing tomail.example.comwith priority10. - 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-allrejects them.
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 inrua. 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 +shortYou 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
Check, in order: that there's a single, correct SPF record, a DKIM record that passes the check, a DMARC record, and a PTR record matching the sending server's name if you send from a VPS. Then check that the server's address isn't on any blacklists. The content itself also matters: avoid shortened links and executable attachments.
Check the MX record with the command dig MX example.com +short: it must point to your current mail server, and that name must have an A record. If you changed nameservers recently, the MX records with the new provider may be missing.
No. An MX record must point directly to a server name that has an A (or AAAA) record.
How is this guide?
DNS propagation and how to check it
Why DNS changes don't appear to every visitor right away, how long they take, and how to check they've gone through with simple commands and make them appear sooner.
Master and slave zones
The difference between master and slave zone types in the DNS management portal, and how to choose the right one for the way you manage your records.