A Complete Beginner's Walkthrough to Domain Authentication and DMARC
Domain authentication DMARC is an email security standard that protects your domain from being impersonated by spammers and phishers. By combining Sender Policy Framework (SPF) and DomainKeys Identified Mail (DKIM), DMARC tells receiving mail servers exactly what to do when an incoming email fails authentication checks.
If you want to create your policy without hassle, you can use the DMARC Record Generator on XiaTools to build a valid DNS record in seconds.
Understanding the Email Authentication Trio
To understand domain authentication, you need to look at how email works at the protocol level. SMTP, the underlying protocol for sending email, has no built-in mechanism to verify the sender's identity. Anyone can write any address in the "From" header. To fix this trust deficit, the industry relies on three complementary protocols working together.
SPF (Sender Policy Framework)
SPF is a TXT record published in your DNS that lists all the authorized IP addresses and servers allowed to send email on behalf of your domain. When a mail server receives an email from user@example.com, it queries the DNS for example.com's SPF record. If the sending IP matches one listed in the record, the check passes. If it does not, the check fails.
DKIM (DomainKeys Identified Mail)
DKIM adds a cryptographic digital signature to the header of every outgoing email. The sending mail server signs the email with a private key, and the public key is published in your DNS settings. When the receiving server gets the message, it fetches the public key and verifies the signature, ensuring the email content was not altered in transit and genuinely originated from your domain.
DMARC (Domain-based Message Authentication, Reporting, and Conformance)
DMARC ties SPF and DKIM together. It introduces the concept of "alignment," checking whether the domain in the visible "From" header matches the domains authenticated by SPF and DKIM. Furthermore, DMARC allows you to specify a policy telling receiving servers what to do with unauthenticated emails (none, quarantine, or reject) and provides daily XML reports detailing who is sending email using your domain.
How DMARC Works in Practice
When an email arrives at a destination inbox like Gmail or Microsoft 365, the receiving server evaluates the message through the following sequence:
- SPF Check: The server inspects the return-path domain and validates the sending IP against the published SPF record.
- DKIM Check: The server validates the cryptographic signature against the public DKIM record found in DNS.
- Alignment Check: The server verifies that the domain in the header matches the domain authenticated by SPF and/or DKIM.
- Policy Enforcement: The server looks up your DMARC TXT record (
_dmarc.example.com) to see what action to take if the alignment or authentication fails.
| DMARC Policy | Action on Failure | Recommended Use Case |
|---|---|---|
p=none |
Deliver normally, send reports | Initial monitoring phase to discover legitimate mail flows |
p=quarantine |
Send to spam/junk folder | Intermediate phase after verifying all legitimate sources |
p=reject |
Block outright at SMTP level | Final enforcement phase for maximum brand protection |
Step-by-Step Guide to Implementing DMARC
Implementing DMARC successfully requires a methodical approach to avoid accidentally blocking your own legitimate marketing or transactional emails.
Step 1: Set Up and Verify SPF
Before touching DMARC, ensure your SPF record is published correctly and does not exceed the 10 DNS lookup limit. A standard SPF record looks like this:
v=spf1 ip4:192.0.2.1 include:_spf.google.com ~all
You can verify your SPF record using command-line tools like dig or nslookup on your workstation:
dig TXT example.com
Step 2: Set Up and Verify DKIM
Log into your email provider or transactional email service and enable DKIM signing. They will provide you with a CNAME or TXT record to publish in your DNS zone (often structured like selector._domainkey.example.com).
Step 3: Publish a Monitoring DMARC Record
Always start with a monitoring policy (p=none) and configure reporting email addresses to collect data. A safe initial record looks like this:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; pct=100
Add this record to your DNS management console as a TXT record with the host name _dmarc.example.com (note the leading underscore).
Step 4: Analyze Reports and Transition to Enforcement
Monitor the XML reports sent to your reporting mailbox for at least two to four weeks. Once you confirm that all legitimate sending sources pass authentication, update your DMARC record to quarantine:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
After another week of clean logs, graduate to the strict reject policy:
v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com
Common Mistakes and How to Fix Them
Even experienced engineers occasionally run into configuration pitfalls. Here are the most common mistakes and how to resolve them:
- Multiple SPF Records: A domain can only have one active SPF record. If you publish two, mail servers will return a permanent error (
temperrororpermerror). Combine all your services (include:,ip4:) into a single SPF record. - Incorrect Hostname: Setting the DMARC record on
example.cominstead of_dmarc.example.com. Always ensure the DNS record host includes the_dmarcprefix. - Moving to Reject Too Fast: Jumping straight to
p=rejectwithout monitoringp=nonereports will often block your own newsletters, CRM notifications, or password reset emails. - SPF Lookup Limit Exceeded: SPF permits a maximum of 10 DNS lookup queries. If you exceed this by nesting too many
includestatements, authentication fails. Flatten your SPF record or use dedicated IP addresses where possible.
DMARC Implementation Checklist
- Inventory all services that send email on behalf of your domain (marketing, CRM, billing, support).
- Publish a valid SPF record containing all authorized sending IPs and includes.
- Enable DKIM signing for all email streams and publish the corresponding public keys.
- Deploy an initial DMARC record with
p=noneand a reporting address (rua). - Review XML reports for 2 to 4 weeks to spot unauthenticated legitimate traffic.
- Upgrade the DMARC policy from
p=nonetop=quarantine, then finally top=reject.