Knowledgebase / Email and Server Security
How to Configure SPF, DKIM and DMARC for Your Email Domain
Inventory every legitimate sender, publish the records supplied by those services, and verify authentication before enforcing a strict DMARC policy.
Prerequisites and sender inventory
You need access to authoritative DNS and the administration screens of every service that sends mail for the domain. Include staff mailboxes, website notifications, billing software and mailing platforms. Changing authentication based only on the main mailbox provider can break legitimate messages from another system.
Save the existing DNS values first. SPF identifies authorized sending sources for the envelope-sender domain. DKIM uses a cryptographic signature with a public DNS key. DMARC evaluates alignment with the visible From domain and publishes a handling policy for failures.
Step 1: Build one SPF policy
Obtain the required SPF mechanisms from each authorized service. Merge them into the domain’s existing SPF policy as appropriate rather than adding multiple competing SPF records at the same name. Observe SPF’s DNS lookup limits and have a mail administrator review a complex policy.
Publish the TXT value at the actual DNS provider. If cPanel hosts mail but Cloudflare serves authoritative DNS, editing only a local cPanel zone will not update public answers. Do not copy an unrelated provider’s include mechanism or allow all senders to make a test pass.
Step 2: Enable and publish DKIM
- Enable DKIM in the sending service if it is available.
- Copy the service-provided selector, record name and public value exactly.
- Publish the requested TXT or CNAME record at authoritative DNS.
- Use the service’s verification check and send a test message.
Different services can use different selectors under the same domain. Preserve selectors still used by active senders. Publish only the public record; a DKIM private key must remain protected in the signing service.
Step 3: Introduce DMARC monitoring
Publish a reviewed DMARC policy at the _dmarc name. Begin with monitoring when you have not yet established that all legitimate sources align. For illustration, v=DMARC1; p=none expresses monitoring rather than a rejection request; it is not a complete reporting setup.
To collect aggregate reports, configure an authorized reporting destination and its required authorization records where applicable. Consider who can access those reports and their operational information. Do not insert an unowned mailbox into a policy example.
DMARC can pass through an aligned SPF pass or an aligned DKIM pass. Simply seeing separate SPF and DKIM pass results is not enough if neither aligns with the visible From domain. Review real headers and aggregate results before moving toward quarantine or reject.
Verification and troubleshooting
Send tests from every inventoried service to external mailboxes you control. Examine Authentication-Results and the visible From domain, taking care not to share complete private message headers publicly. Fix a failing source at its sender configuration or DNS record rather than weakening the whole domain policy.
Check for duplicate SPF records, incorrect selector names, stale DNS and forwarding effects. Authentication improves sender verification but does not guarantee inbox placement. Reputation, message quality, consent and recipient filtering still matter. Success means legitimate sources authenticate and align while the chosen policy is understood and monitored.
Frequently asked questions
Should I add a second SPF record for another service?
No. Review and merge authorized mechanisms into a single SPF policy at that name.
Does DMARC require both aligned checks to pass?
An aligned SPF pass or aligned DKIM pass can satisfy DMARC. Evaluate alignment, not just standalone pass labels.
Will authentication guarantee inbox delivery?
No. Recipient filtering and sender reputation still affect delivery.
Related guides and hosting options
Compare email hosting against your application requirements. Confirm available tools and management responsibilities for your own account. For account-specific help, open a private support ticket with the domain, time and relevant redacted error.