how to set up dmarc dmarc record spf dkim dmarc

How to set up DMARC, with SPF and DKIM first

Adrian Maverick · · 9 min read

To set up DMARC, first make sure SPF and DKIM are working for every service that sends mail as your domain. Then publish a TXT record at _dmarc.yourdomain.com starting with p=none and a reports address, read the reports, and tighten the policy to quarantine and then reject once only your own mail is passing.

It is three DNS records and some patience. The patience is the part people skip, and it is the part that keeps your own invoices and password resets out of spam.

SPF, DKIM and DMARC in plain language

SPF is a list. It names the servers allowed to send mail for your domain. A receiver looks up the list and checks whether the sending server is on it.

DKIM is a signature. Your mail host signs each outgoing message with a private key, and publishes the matching public key in your DNS. A receiver checks the signature, which proves the message came through your setup and was not altered on the way.

DMARC is the rule that ties them to the address people actually see. SPF and DKIM on their own can pass for any domain, including a scammer's. DMARC asks whether the domain that passed matches the domain in the From line. The DMARC standard, RFC 9989, calls this alignment: a message passes if SPF or DKIM passes for a domain aligned with the From address. DMARC also tells receivers what you want done with mail that fails, and where to send reports.

A note on standards: RFC 9989, published in May 2026, replaced the original DMARC document, RFC 7489. Your existing records keep working, but a couple of tags changed status, covered below.

Step 1: List everything that sends as your domain

Before you touch DNS, write down every system that sends mail with your domain in the From line:

  • Your mailbox host
  • A newsletter or marketing tool
  • Your shop, booking or invoicing software
  • A help desk or contact form
  • Any server or printer that sends alerts

Each one needs to pass SPF or DKIM for your domain. Google's DMARC setup page says that if a third-party service sends for you, you must make sure its messages pass SPF and DKIM, so check each provider's help pages for the records they want you to add. Missing one here is the most common reason a DMARC rollout breaks real mail.

Step 2: Publish one SPF record

SPF is a single TXT record on your domain itself (the @ or blank host at most DNS hosts). An example for a domain that uses a mail host plus one newsletter tool:

v=spf1 include:_spf.mailhost.example include:spf.newsletter.example ~all

Use the include values your providers give you. The ending matters. Under RFC 7208, ~all means softfail (anything else is suspect) and -all means fail (anything else is not allowed).

Two rules from the RFC catch people out:

  • One record only. A domain "MUST NOT have multiple records". Two v=spf1 lines produce an error, so add new services to the existing record instead of creating a second.
  • Ten lookups at most. The terms include, a, mx, ptr, exists and redirect all trigger DNS lookups, and nested includes count. Go over 10 and the check returns an error (permerror). Remove includes for services you no longer use.

Step 3: Turn on DKIM at every sender

DKIM is usually a switch in your mail host's settings. The host generates a key pair and shows you a record to publish. It lives at a name like selector._domainkey.yourdomain.com, and the value looks like this:

v=DKIM1; k=rsa; p=MIIBIjANBgkqh...

The p= part is the public key, and it is long. Copy it exactly from your provider. Google's sender guidelines require a DKIM key of 1024 bits or longer for mail to Gmail and recommend 2048 bits where your provider supports it.

Each provider uses its own selector, so several DKIM records sit side by side without conflict. Turn it on for every sender from step 1, not just your mailbox. When you rotate keys, RFC 6376 advises assigning new keys to new selectors rather than reusing old names.

Step 4: Wait, then set up a reports mailbox

Google says to let SPF and DKIM authenticate for 48 hours before you turn on DMARC. Use that time to create the address that will receive reports.

Make it a separate mailbox or group, not your personal inbox. Google warns that reports can be numerous: large organizations get hundreds or even thousands a day. The RFC adds that reports are formatted for machines, so most people either use a report-reading service or a free parser rather than reading them raw.

Step 5: Publish DMARC at p=none

Add a TXT record with the host _dmarc (some DNS hosts want the full _dmarc.yourdomain.com) and this value:

v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com

What each part does:

Tag Meaning
v=DMARC1 Required, and must come first
p=none Deliver failing mail normally, just report on it
rua= Where aggregate reports go. Leave it out and receivers send none

RFC 9989 calls this monitoring mode and says domain owners usually start here. Google's sender guidelines accept p=none for bulk senders too.

Step 6: Read the reports and fix what fails

Reports show which servers sent mail as your domain and whether each one passed. You will see two kinds of failure:

  • Your own services that are missing from SPF or not signing with DKIM. Fix these. The RFC says legitimate streams must be fixed before you move to enforcement.
  • Servers you do not recognize. That is spoofing, and it is exactly what the next steps shut out.

How long to watch? Google's recommended rollout says one week is usually enough for the daily reports to cover all your mail streams. The RFC is more cautious: depending on how often you send, it may take many months, and for domains whose users post to mailing lists it suggests p=none for at least a month first. A quarterly invoice run will not show up in one week of reports, so wait until every sender from step 1 has appeared and passed.

Step 7: Move to quarantine

v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com

Failing mail now goes to the recipient's spam folder, where it can still be found. Keep reading reports.

You may see guides use pct= to apply the policy to only part of your mail, for example pct=10. Google's and Microsoft's help pages both still show it. Under RFC 9989, though, pct is now listed as historic, and the new standard adds a test flag instead: t=y asks receivers to apply one level below your stated policy while you test. If your reports are clean, the simplest path is p=quarantine with neither tag.

Step 8: Move to reject

v=DMARC1; p=reject; rua=mailto:dmarc-reports@yourdomain.com

Receivers are now asked to refuse failing mail outright. Google's rollout page puts it bluntly: rejected messages are never delivered. Microsoft's guide calls p=reject the goal and suggests doing lower-volume subdomains first, saving the parent domain for last.

Before you flip it, check one rule from RFC 9989: a domain at p=reject must not rely on SPF alone and must sign with DKIM. Forwarding breaks SPF, because the forwarding server is not on your list, while DKIM signatures usually survive. The RFC also warns that p=reject can cause trouble for users who post to mailing lists, and suggests running quarantine for as long as you ran none before going further.

Check your records from a terminal

On a Mac or Linux:

  • dig +short TXT yourdomain.com should show exactly one line starting with v=spf1
  • dig +short TXT selector._domainkey.yourdomain.com should show your DKIM key
  • dig +short TXT _dmarc.yourdomain.com should show your DMARC record

Then send a message to an account at another provider and open its headers. Look for spf=pass, dkim=pass and dmarc=pass. Our email header analyzer reads them for you, and our guide to reading email headers explains each line.

Gotchas

  • Strict alignment. adkim=s and aspf=s demand an exact domain match. Google notes relaxed alignment, the default, is typically enough, and strict can push mail from your own subdomains into spam.
  • Subdomains. Without an sp= tag, subdomains follow your main policy. Account for any tool that sends from mail.yourdomain.com or similar.
  • Failure reports. The ruf= tag requests per-message reports, but Google says Gmail does not support it and Microsoft says Microsoft 365 does not send them. Rely on rua.

Frequently asked questions

Do I need DMARC if I only send a few emails?

Gmail's sender guidelines require DMARC only above 5,000 messages a day, but require SPF or DKIM from every sender. Google still recommends SPF, DKIM and DMARC for all domains, and a p=none record costs nothing and gives you reports.

What do Gmail and Yahoo require?

Since February 2024, both ask every sender for SPF or DKIM and a spam rate below 0.3%. Bulk senders need SPF, DKIM and a DMARC record of at least p=none, with the From domain aligned, plus one-click unsubscribe. Yahoo's page adds that unsubscribes must be honored within 2 days.

Is p=none enough?

For Gmail's and Yahoo's bulk rules, yes. For protection, no. The RFC describes p=none as offering "no expression of preference", so spoofed mail is still delivered. It is a starting point.

What is the difference between quarantine and reject?

Quarantine asks receivers to treat failing mail as suspicious, usually sending it to spam. Reject asks them to refuse it. Receivers make the final decision either way.

Does DMARC stop all spoofing?

No. It covers your exact domain. RFC 9989 says display name attacks, where a fake address uses a familiar name, are out of its scope, and lookalike domains are separate domains with their own records. Our guide on how to tell if an email is spoofed covers what to check as a recipient.

DMARC with Secria

If your domain's mail is on Secria, custom domains come with Mail Plus ($3.99 a month, up to 3 domains) and Pro ($9.99 a month, up to 10 domains). After you verify the domain with a TXT record, Secria shows the MX, SPF, DKIM and DMARC records to add, each with a copy button, and checks them for you. Teams can use Secria Workspace with their own domain, SPF, DKIM and DMARC checked. Every plan uses post-quantum encryption, ML-KEM-1024 with X25519. If you are changing hosts at the same time, our guide to moving domain email to a new provider covers the order.

Secria fact-checks every post against primary sources. Spotted something wrong or out of date? Email hq@secria.me and we will correct it.