What Is DMARC? A Developer’s Guide to Email Authentication
Learn how DMARC works with SPF and DKIM, publish a DNS record, review reports, and move safely from monitoring to enforcement.
DMARC is a DNS policy that tells receiving mail servers how to handle messages that claim to come from your domain but fail email authentication. It also lets you request reports about those messages.
DMARC works with SPF and DKIM. It checks whether at least one of them passes and matches the domain in the message’s visible From address. That match is called alignment. If neither SPF nor DKIM passes with alignment, the message fails DMARC.
DMARC helps protect your domain from spoofing and gives you a way to see which services send mail using it. It does not encrypt email, and a DMARC policy cannot guarantee that every receiving server will handle a message in the same way.
How DMARC checks a message
A message has more than one domain associated with it. The visible From address is the one a recipient sees. SPF checks the domain used for the return path, while DKIM checks the domain in the signature.
For DMARC to pass, one of these must be true:
- SPF passes, and its return-path domain aligns with the visible
Fromdomain. - DKIM passes, and the signing domain in the DKIM signature aligns with the visible
Fromdomain.
By default, DMARC uses relaxed alignment. A subdomain can align with its parent domain. For example, mail.example.com can align with example.com. Strict alignment requires an exact domain match.
A message can pass SPF but fail DMARC if the SPF domain does not align. The same is true for DKIM. That is why checking SPF or DKIM alone does not tell you whether DMARC will pass. For a deeper explanation, see SPF, DKIM and DMARC explained for developers.
Publish a DMARC record
DMARC is published as a TXT record in your domain’s DNS. For a domain called example.com, the record name is _dmarc.example.com.
Start with a monitoring policy:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
Add this as a TXT record with these values:
| DNS field | Value |
|---|---|
| Name or host | _dmarc |
| Type | TXT |
| Value | v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com |
Some DNS providers add your domain name automatically, so enter _dmarc rather than _dmarc.example.com. Follow your provider’s instructions for the name field.
The rua tag specifies where aggregate reports should be sent. Create an address or reporting service that can receive them. These reports are usually XML files, not messages intended for a person’s inbox. If you leave out rua, you can still publish a DMARC policy, but you won’t request aggregate reports.
Check the published record from a terminal:
dig TXT _dmarc.example.com +short
A correct result should include the DMARC value, for example:
"v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
You can also look up a domain with the DMARC checker.
Move from monitoring to enforcement
The p tag sets the policy you ask receiving servers to apply to messages that fail DMARC:
p=noneasks servers not to change their handling based on DMARC. Use it to begin monitoring.p=quarantineasks servers to treat failing messages as suspicious, often by placing them in spam.p=rejectasks servers to reject failing messages.
These are requests to receiving servers, not guarantees about delivery. A server’s handling can vary.
Don’t switch to quarantine or reject until you know which services send mail using your domain. Include app mail, password resets, support replies, newsletters, billing tools and any other service that uses your domain in the From address. For each service, confirm that SPF or DKIM passes and aligns with that address.
Review reports, fix authentication for legitimate senders, then move to an enforcement policy when you are confident that those senders are covered. Make changes carefully and keep checking reports after each change. A policy that blocks spoofing can also affect your own mail if a legitimate sender is not set up correctly.
Common DMARC errors
dig returns no answer. The record may not exist, the name may be wrong, or the DNS change may not have propagated yet. Check that the TXT record is at _dmarc for the right domain and try the lookup again later.
You see v=DMARC1 more than once. A domain should have one DMARC TXT record. If you have multiple DMARC records, combine the tags into one record and remove the duplicates. Multiple records can cause DMARC evaluation errors.
The record is found, but DMARC still fails. The DNS record being present does not mean a message passes DMARC. Check the message’s authentication results. SPF or DKIM must pass and align with the visible From domain. A service may authenticate with its own domain instead of yours.
Reports never arrive. Check that the address in rua can receive mail and that the value is spelled correctly. Reports can also be sent in compressed formats, so your mailbox or reporting tool may not display them as readable text.
A sender breaks after you set p=reject. That sender may not have aligned SPF or DKIM. Restore a monitoring policy if needed, then fix the sender’s authentication before enforcing the stricter policy again.
What DMARC does not do
DMARC does not stop every unwanted message, and it does not authenticate the person who sent a message from a different domain. It focuses on mail that claims to use your domain in the visible From address. It also does not replace SPF or DKIM. It uses their results, along with domain alignment, to determine whether a message passes.
If your app sends email, set up SPF and DKIM for the sending service before enforcing DMARC. Then publish a monitoring record, review reports, and move to a stricter policy only after your legitimate mail passes.