How to Configure SPF, DKIM and DMARC for a Custom Domain
Read as MarkdownLearn how to configure SPF, DKIM, and DMARC records for your custom email domain to improve deliverability and prevent spoofing.

Setting up SPF, DKIM and DMARC for a custom domain ensures your emails arrive directly in the recipient's inbox rather than getting caught in spam filters. Major email providers such as Google and Yahoo enforce strict authentication requirements, rejecting or quarantining messages from domains that lack proper DNS validation records.
Configuring these three authentication standards establishes domain authority, verifies message integrity, and protects your domain against spoofing and phishing attacks. Here is how each protocol works and how to implement them step by step.
What SPF, DKIM and DMARC Do
Email authentication relies on three complementary layers:
- SPF (Sender Policy Framework) specifies which mail servers and IP addresses are authorized to send email on behalf of your domain. You publish an SPF record as a TXT record in your DNS settings. When a receiving server gets an email claiming to originate from your domain, it verifies whether the sender's IP address matches your authorized list.
- DKIM (DomainKeys Identified Mail) adds a cryptographic digital signature to the headers of outgoing emails. Your mail provider signs each email using a private key, while you publish the corresponding public key in your DNS records. The receiving server validates the signature against the public key, proving the email was not modified or tampered with in transit.
- DMARC (Domain-based Message Authentication, Reporting, and Conformance) unifies SPF and DKIM. It tells receiving servers what action to take (none, quarantine, or reject) if an incoming email fails SPF or DKIM checks, and allows you to receive aggregate delivery reports.
Step 1: Configure Your SPF Record
To configure SPF, log in to your DNS registrar or hosting provider control panel. Locate the DNS management section for your domain.
Check whether an existing SPF TXT record already exists. A domain should only ever have one SPF TXT record. Having multiple SPF records causes authentication to fail automatically.
If no record exists, create a new TXT record:
- Host / Name:
@(or leave blank depending on your DNS host) - Type:
TXT - Value:
v=spf1 include:_spf.example.com ~all(replace_spf.example.comwith your email service provider's specific SPF include statement)
The ~all mechanism specifies a soft fail, which flags unlisted servers without outright dropping legitimate messages during testing, whereas -all specifies a hard fail.
Step 2: Generate and Publish DKIM Records
Your email hosting provider generates the DKIM key pair. In your provider's admin console, locate the email domain authentication or DKIM settings.
Generate a new DKIM key. The provider will supply:
- A selector name (such as
s1ormail) - A DNS record type (either
CNAMEorTXT) - The host name (typically
selector._domainkey.yourdomain.com) - The target value containing the public key or provider target address
Copy these details into your DNS manager and create the corresponding record. Once saved, return to your email provider dashboard and click verify.
Step 3: Implement Your DMARC Policy
Once SPF and DKIM are active, configure DMARC to enforce domain protection. Create another TXT record in your DNS zone:
- Host / Name:
_dmarc - Type:
TXT - Value:
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com
Starting with p=none is recommended for initial monitoring. This setting allows receiving servers to accept all messages while generating XML reports sent to your specified email address, letting you verify that legitimate sending services pass authentication before switching to p=quarantine or p=reject.
Step 4: Verify and Test DNS Propagation
DNS changes can take between a few minutes and 24 hours to propagate across global nameservers. Once configured, send a test email to a webmail inbox or use standard mail header analysis tools to verify that SPF, DKIM, and DMARC headers all return passing results. Proper email authentication maintains high deliverability and protects your sender reputation.
Related articles

Email auto-reply: How to set up an automatic response
An email auto-reply answers for you while you're away — here's how it works and how to set it up.
Läs artikeln
Phishing in email — how to recognize a scam message
Phishing is the most common form of email fraud. Learn the warning signs and what to do when the scam message lands in your inbox.
Läs artikeln
Email Forwarding on Your Own Domain: Keep Your Inbox
Send email to an address on your own domain and have it forwarded to your existing inbox — no new mailbox or provider needed. Here's how to set it up step by step.
Läs artikeln
Email signature in email: How to create a professional signature
An email signature is automatically appended to each email you send. Learn how to create a professional email signature with your name, contact details and using your email provider.
Läs artikeln