Bridge CDN
On this page

Which email DNS records does a domain need?

Every domain that sends or receives mail needs all four parts of its email DNS. They live in the same zone as your website records, and each has a fixed place:

Record Stored as Name What it does Example value
MX MX @ Points incoming mail at your provider's servers 10 mx1.example.net.
SPF TXT @ Lists servers allowed to send as your domain v=spf1 include:_spf.example.net -all
DKIM TXT or CNAME selector._domainkey Publishes the public key that verifies signatures v=DKIM1; k=rsa; p=MIIBIjAN…
DMARC TXT _dmarc Sets the policy and where reports go v=DMARC1; p=none; rua=mailto:dmarc@example.com

A domain that only receives mail still benefits from SPF and DMARC. A domain that never sends mail should publish v=spf1 -all and a DMARC record with p=reject. That tells receivers anything claiming to be from it is fake, which shuts down spoofing of an unused domain.

How do the four records work together?

They answer different questions at different moments, which is why one can be perfect while mail still fails.

  1. Someone sends you a message. Their server looks up your MX records and connects to the host with the lowest priority number (RFC 5321).
  2. You send a message. The receiving server checks SPF: is the connecting IP listed for the domain in the envelope sender?
  3. It checks DKIM. Your provider signed the message. The receiver fetches the public key from selector._domainkey and verifies the signature.
  4. It checks DMARC. At least one of SPF or DKIM must pass and align with the domain in the visible From address. If neither does, the receiver applies your DMARC policy: deliver, quarantine or reject.

The alignment step is the one people miss. A newsletter tool can pass SPF for its own bounce domain and still fail DMARC for yours, because the domains don't match.

MX: where incoming mail goes

MX records list your provider's mail servers with a priority. Lower numbers are tried first. Equal numbers share the load. An MX target must be a hostname with its own A or AAAA records, never an IP address and never a CNAME (RFC 2181).

Copy every MX host from your provider's email DNS settings, with the same priorities. Leaving one out rarely breaks mail immediately. It breaks it on the day the primary host is down.

Field-by-field syntax and priority rules are in the MX record reference.

SPF: who may send as your domain

SPF is a single TXT record at the domain that starts with v=spf1 (RFC 7208). It lists the IP addresses and services allowed to send for you, and ends with a verdict for everyone else: -all to fail them, ~all to soft-fail.

Two limits catch people out. A domain may have only one SPF record, so a second v=spf1 record makes both invalid. And evaluating the record may take no more than 10 DNS lookups. Each include, a, mx, exists and redirect costs at least one, and nested includes count too.

Step-by-step instructions, including how to merge two providers into one record: how to add and verify an SPF record.

DKIM: a signature on every message

DKIM (RFC 6376) lets your mail provider sign outgoing messages with a private key. The matching public key sits in DNS at selector._domainkey.example.com, where the selector is a label your provider chooses. Receivers fetch it and check that the message wasn't altered in transit.

Some providers give you a TXT record holding the key. Others give you a CNAME pointing at a key they host and rotate themselves. Use whichever form they specify. A 2048-bit key is longer than one TXT string can hold (255 characters), so it's split into several quoted strings that receivers join together.

Setup and verification: how to add and verify a DKIM record.

DMARC: the policy and the reports

DMARC (RFC 7489) is a TXT record at _dmarc.example.com. It does two jobs: tells receivers what to do with mail that fails alignment, and asks them to send you reports. The policy tag p= takes none, quarantine or reject.

Start with p=none and a rua= address. Reports show every source sending as your domain, including the ones you forgot about: the invoicing system, the CRM, the old marketing tool. Once legitimate mail passes, move to quarantine and then reject.

Choosing and rolling out a policy: how to add a DMARC record.

How to use your email provider's DNS values

Your provider's setup screen lists the exact email DNS records it needs. Most delivery problems we see come from copying them slightly wrong:

  • The name field. Providers write names in different styles. Some show @, some the full example.com, some selector._domainkey. In a zone editor that appends your domain, entering the full name can create example.com.example.com. Query the result to be sure.
  • Quotes. TXT values are quoted in zone files. Whether the editor wants them typed is a UI detail.
  • Two providers, one SPF. If you use one service for mailboxes and another for newsletters, merge both include: entries into a single SPF record.
  • Trailing characters. Copying from a PDF or chat window can add a space or a line break inside a DKIM key. One stray character fails every signature.

Leave TTLs on Auto while you set mail up. Auto TTL resolves to 60 seconds for A, AAAA, and CNAME records and 120 seconds for every other record type. Cached responses can remain until their TTLs expire.

Website and email records in one zone

Your website and your email DNS share one zone, but they need different treatment.

Web records can go through the Bridge proxy: the apex and www A records answer with the edge, and your server's address stays private. Mail can't. The proxy handles web traffic, so every hostname used for mail must stay DNS-only. That covers MX targets, mail.example.com, and any hostname your provider asks you to point at its servers.

A layout that works:

  • example.com A record, proxied (the website);
  • www CNAME to example.com (the website);
  • example.com MX pointing at your provider's hosts, DNS-only by nature;
  • mail A record, DNS-only, if you run your own mail server;
  • SPF, DKIM and DMARC TXT or CNAME records, never affected by the proxy.

The two halves are independent, which helps when you change things. Moving your website to a new host means editing the A records. Your email DNS records don't move, and mail keeps flowing.

What large mailbox providers now require

Since February 2024, Gmail and Yahoo expect authenticated mail from everyone who sends to them. All senders need SPF or DKIM. Bulk senders, roughly 5,000 or more messages a day to Gmail addresses, need SPF and DKIM, a DMARC record (p=none is enough), alignment with the From domain, and one-click unsubscribe for marketing mail. Microsoft publishes similar requirements for high-volume senders to Outlook.com. See the current Gmail and Yahoo requirements for the details.

In practice, if you're a bulk sender or send any real volume of mail, set up all four DNS records for email. Treat DMARC as required rather than optional.

How to check email DNS records

Use dig against a public resolver to check your DNS for email:

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

Then send a message to an external mailbox and open the full headers. The Authentication-Results line shows spf=pass, dkim=pass and dmarc=pass, or tells you which one failed and why. That header is the most honest test there is, because it's the receiver's own verdict.

When an authentication check fails

When mail fails a check, the fault is almost always in the DNS for email, not in the mail server. Read the Authentication-Results header first. It names the check that failed, and each one has its own short list of causes:

  • spf=fail or permerror: two SPF records on one name, more than 10 DNS lookups, or a sender missing from the record. See SPF errors.
  • dkim=fail or no signature: the selector name doesn't match, the key was split badly, or signing isn't switched on at the provider. See DKIM errors.
  • dmarc=fail while SPF or DKIM pass: an alignment problem, because the passing domain isn't the one in the From address. See DMARC errors.

Guides for specific mail providers

Setup screens differ between providers, so the two most common ones have their own walkthroughs:

For other providers, the email DNS records are the same four kinds. Only where you find the values differs:

Provider Records you add Where the values come from
Proton Mail Verification TXT, two MX, SPF TXT, three DKIM CNAMEs, DMARC TXT Domain settings in the Proton dashboard
Zoho Mail Verification TXT or CNAME, three MX, SPF TXT, DKIM TXT Zoho Mail admin console. Hostnames differ by data-centre region.
Fastmail Two MX, SPF TXT, three DKIM CNAMEs Domain settings in Fastmail
Amazon SES Three DKIM CNAMEs. Optional MX and SPF for a custom MAIL FROM domain. SES console, verified identities
SendGrid CNAME records for the return path and DKIM, if automated security is on Sender authentication screen in SendGrid

Copy each value exactly from the provider's screen on the day you set it up. Providers change hostnames, and an old blog post is the usual source of a wrong record.

Our setup guides cover the rest of the zone.

Email DNS records FAQ

What DNS records do I need for email?

You need MX records to receive mail, an SPF TXT record listing who may send for you, a DKIM record holding your provider's public key, and a DMARC TXT record at _dmarc with your policy. Your mail provider supplies the MX, SPF and DKIM values.

Can I have two SPF records?

No. RFC 7208 allows one SPF record per name, and two v=spf1 records make SPF fail with a permanent error. Merge the mechanisms from both into one record, for example v=spf1 include:_spf.example.net include:mail.example.org -all.

Do I need DMARC if I already have SPF and DKIM?

Yes. SPF and DKIM prove things about the sending server and the message, but neither tells receivers what to do when checks fail. DMARC adds that policy and gives you reports. Gmail and Yahoo require it for bulk senders.

Why does my email go to spam even though SPF passes?

SPF can pass for a different domain than the one in the From address, so DMARC alignment still fails. Check the Authentication-Results header. If dmarc=fail appears, make sure DKIM signs with your own domain.

How long do email DNS changes take to work?

On Bridge nameservers, seconds. Receivers that cached the old record keep it until its TTL expires. That's 120 seconds for MX and TXT on Auto in Bridge DNS, and whatever TTL your previous provider used if you just moved.

Should mail hostnames be proxied?

No. The Bridge proxy carries web traffic. Keep MX targets and any mail server hostnames DNS-only so senders reach your mail server directly.