How to set up SPF, DKIM and DMARC for your domain
A customer places an order and waits for a confirmation. The shop marks the email as sent, but it never arrives. Meanwhile, messages from the team's usual mailboxes are going through. Before changing DNS, find out which service sent the missing confirmation and what the receiving mail server made of it.
Your shop, CRM and team can use the same address in the From field even when they send through different systems. Settings that work for staff mail can leave the other two unverified.
With Host4Biz's domain email tools, you can see your current DNS records, build SPF and DMARC records and check whether the published records are visible. Then you can verify the results in a test message.
Start with the systems that send your mail. SPF checks which servers may send, DKIM verifies the signature and DMARC checks whether a successful result matches the domain in From. MX records tell other servers where to send incoming mail.
1. Find your DNS zone and list your senders
Edit the zone served by the domain's active nameservers. That might be at your registrar, hosting company or a separate DNS provider. Save the current values before changing anything.
In our example, Google Workspace handles staff mail and the shop sends order confirmations through Google's SMTP service. The CRM uses another provider. Make a list of your own sources, including invoices, password resets and newsletters. For each, find out which service actually delivers the message and whether it can sign with your domain.
Check where replies go. MX records tell other mail servers where to deliver incoming mail. Use the MX lookup to compare the hostnames and priorities with the values from your incoming mail provider. A CRM used only for outbound mail leaves that route alone. Send a message from an outside address to a work mailbox to test reception.
2. Build one SPF record per sending domain
SPF checks whether the sending server's IP is allowed by the domain in the SMTP envelope (MAIL FROM). That's often different from the visible From address. Send a test email from each source to an outside mailbox, open the original and look for smtp.mailfrom in Authentication-Results. The domain is also usually visible in Return-Path.
Group sources by the MAIL FROM domain. The team and shop in our example both use example.com and send through Google. Google's entry covers both. If the shop starts sending directly and keeps the same envelope domain, its outgoing IP needs to go in that record too.
The CRM can use three different envelope domains.
| MAIL FROM domain on CRM messages | Where to configure SPF |
|---|---|
| example.com | Add the CRM provider's mechanism to the existing SPF record for example.com. |
| bounce.example.com | Follow the CRM instructions for that subdomain. You may be asked to add a TXT or delegate via CNAME. The parent SPF record does not apply automatically. |
| The CRM provider's own domain | The provider manages SPF. To pass DMARC with your address in From, you can enable DKIM signing with your domain. |
A provider's include lets it maintain its own list of sending servers. Copy the exact value from its instructions. The hostname can differ from the SMTP hostname in your shop settings. For a server you operate that sends directly from a fixed address, use ip4: or ip6:. If it sends through a relay, use the relay provider's instructions.
Suppose Google and the CRM both send with example.com in MAIL FROM and a separate server sends invoices directly. A combined TXT record could look like this:
v=spf1 ip4:192.0.2.25 include:_spf.google.com include:_spf.crm.example.net ~all
The CRM hostname and IP are examples. Replace them with your actual values. Start with one v=spf1, put the permissions between it and the final rule and keep the existing final rule unless you intend to change your policy. In this example ~all gives softfail for IPs that do not match any listed source.
Edit the existing SPF TXT. Two records beginning with v=spf1 at the same name cause an error, while unrelated TXT records can stay. Your DNS panel may represent the zone apex with @, a blank field or the full domain.
Use the SPF record generator to build the record and the SPF checker after publishing. SPF allows up to ten DNS-querying terms per evaluation, including nested includes. Exceeding that limit produces permerror. Retest each source and check spf=pass and the domain in smtp.mailfrom. RFC 7208.
3. Enable DKIM for each sending service
DKIM lets the receiver check which domain signed the message and whether the signed parts survived the journey. The sender keeps the private key. The receiver looks up the public key in DNS.
Look at DKIM-Signature on the test confirmation. If it contains d=example.com and s=google, the key is at google._domainkey.example.com. The value after s= is the selector. The CRM can sign with the same domain and use its own selector, for example crm, whose key would be at crm._domainkey.example.com.
| Sending service | What to publish |
|---|---|
| Google Workspace | Copy the selector and public key TXT from the Admin console and turn on signing after publishing it. |
| Microsoft 365 | Copy the two CNAME records issued for your domain and enable signing once they are visible. |
| Web hosting email or CRM | Copy the exact hostname, record type and value from the provider. This is usually a TXT with a key or a CNAME to a record the provider manages. |
If your DNS panel appends example.com, enter just google._domainkey and check the resulting full name. Use the DKIM checker with the domain and selector. Then send a fresh message and look for dkim=pass with the expected signing domain. If you only see the CRM's domain, check whether custom-domain signing is active. Google Workspace, Microsoft 365.
4. Check domain alignment and start monitoring with DMARC
DMARC starts with the visible From domain. For [email protected], that's example.com.
- SPF. The sending IP is permitted and the envelope domain aligns with From.
- DKIM. The signature is valid and its domain aligns with From.
Either is sufficient. Under the default relaxed alignment, bounce.example.com and example.com can align. Strict alignment requires an exact match. The CRM's crm.example.net won't align with example.com.
Publish or edit the TXT record at _dmarc.example.com. For an initial monitoring setup, use a record like this:
v=DMARC1; p=none; rua=mailto:[email protected]
p=none starts monitoring. rua gives participating receivers an address for aggregate reports. Use a working mailbox. If an external service collects reports, follow its instructions for authorising receipt. Use the DMARC record generator and confirm publication with the DMARC checker.
Reports show sending IPs, message counts and authentication results. Let them cover a normal business cycle, including occasional mail such as monthly invoices. Once legitimate sources pass, you can ask receivers to quarantine failures with p=quarantine or reject them with p=reject. Each receiving system makes the final decision. RFC 9989.
5. Check reverse DNS and blocklists if you send directly
If the shop starts delivering email from its own server, check the address the recipient sees.
- Find the outgoing IP. Identify the IP from its delivery report, SMTP logs or a received message. The website, incoming MX and outgoing server may have different addresses.
- Check DNS in both directions. For example, the PTR for 192.0.2.25 can point to smtp.example.com, whose A record resolves back to 192.0.2.25. With IPv6, check the AAAA record. Set A or AAAA in your DNS zone and ask the IP provider about PTR.
- Check blocklists. Enter that same outgoing IP in the blocklist checker. If it appears on a list, compare the reason with your logs and SMTP replies. A clean result covers the lists that were checked.
Google Workspace and CRM services manage reverse DNS for their own sending IPs. If a message is refused, check the exact SMTP reply. Gmail sender guidelines.
6. Check public DNS and actual messages
The domain email check groups up to nine results. A score of 7 out of 8 means seven checks passed and one needs a closer look. Checks without data can be skipped. PTR, blocklists and STARTTLS in the combined report refer to incoming MX servers. Use the actual outgoing IP when diagnosing a separate sending server.
| Check | What it looks at |
|---|---|
| MX | Incoming mail route and the addresses of the receiving servers |
| PTR | Reverse DNS and forward confirmation for incoming server IPs |
| SPF | Presence and syntax of the sending policy |
| SPF policy | The final rule and DNS lookup problems |
| DKIM | The public key for the detected or supplied selector |
| DMARC | Presence and syntax of the published record |
| DMARC policy | Monitoring or enforcement |
| Blocklists | Responses from available lists for MX addresses |
| TLS | STARTTLS and TLS settings on reachable incoming SMTP servers |
Send a message from a staff mailbox, place a test order and trigger a CRM notification. Open each original and find the receiving system's Authentication-Results.
In this simplified example, the CRM sends as [email protected]:
spf=pass smtp.mailfrom=bounces.crm.example.net
dkim=pass header.d=crm.example.net
dmarc=fail header.from=example.com
Both checks pass for the CRM provider's domains. To pass DMARC, enable signing with your domain and retest. A valid signature showing dkim=pass header.d=example.com is enough even if the envelope domain stays with the CRM. If the provider supports a custom envelope domain, aligned SPF is another option.
Before you enforce DMARC
- Test incoming delivery and compare MX records with the provider's settings.
- Check authentication in a received message from each source. Note the DKIM selector if a signature needs investigation.
- Review aggregate reports over a period that includes infrequent senders.
- If authentication passes and messages still go missing, check SMTP replies, spam folders, sender reputation and complaints.
Summary
MX gets replies to the right mailboxes. SPF covers the servers allowed to send, DKIM verifies the signature and DMARC ties a successful check to the address customers see. Test every route before enforcing DMARC.
Start with the email your customer is waiting for. Place a test order and look for the confirmation in an outside mailbox. If it arrives, save the successful headers for the next SMTP or CRM change. If it doesn't, find the message in your sending log and check the receiver's reply.
If you use Host4Biz DNS hosting and are unsure which record to edit, send support your domain and the check results. If you need business mailboxes alongside your site, see the web hosting plans.