Email was designed without any way to prove who sent a message. Anyone can put your domain in the From line. SPF, DKIM and DMARC are three DNS records that let receiving servers check whether a message really came from you, and decide what to do when it didn't.
This guide is for anyone who has set up business email and wants it to land in the inbox, and for developers whose apps send mail. By the end you will know what each record does, how to write it correctly, how to roll out DMARC without blocking your own mail, and how to check it all from a terminal.
How the three fit together
- SPF lists the servers allowed to send mail for your domain.
- DKIM adds a cryptographic signature to each message, checked against a public key in your DNS.
- DMARC ties both to the address people actually see in the From line, tells receivers what to do when checks fail, and sends you reports.
SPF: who may send
SPF is a TXT record on your domain. Receivers look at the envelope sender (the bounce address, which is often different from the From line people see) and check whether the sending server's IP is allowed.
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"The parts:
v=spf1starts the record.include:pulls in another domain's list, usually your email provider's.ip4:andip6:list addresses directly, andaandmxallow your domain's own A or MX hosts.~all(soft fail) marks everything else as suspicious;-all(fail) says it should be rejected.
If several services send for you, combine them in one record:
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com include:mail.example.net ip4:192.0.2.25 ~all"Two limits catch people out:
- Only one SPF record per domain. Two
v=spf1records cause a permanent error, and receivers treat that as having no valid SPF at all. - No more than 10 DNS lookups. Each
include,a,mx,existsandredirectcounts, including those inside included records.ip4,ip6andalldon't. Go over 10 and SPF fails.
For Premium Email, the SPF record is added for you on RemoteGeeks DNS or a connected Cloudflare account; otherwise it is shown in View DNS instructions. If you already have an SPF record, merge the new include: into it rather than adding a second record.
DKIM: a signature on every message
With DKIM, your provider signs each outgoing message with a private key. The public key is published as a TXT record at selector._domainkey.yourdomain. The selector is a label the provider chooses, so one domain can have several keys for different services.
; replace the p= value with the exact key your provider gives you
google._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=PASTE_PUBLIC_KEY_HERE"You never write a DKIM key yourself. Copy the selector and value from your provider exactly. Keys are often longer than 255 characters, so the record is split into several quoted strings; most DNS dashboards handle that for you.
- Google Workspace: generate the DKIM key in Google Admin under Gmail's Authenticate email setting, publish the TXT record it shows, then return to Google Admin and start authentication.
- Other services: newsletter tools, invoicing systems and similar each provide their own selector and value, or a CNAME to publish. Check your provider's control panel or ask their support.
DKIM survives forwarding as long as the message isn't changed, which makes it the more reliable of the two checks.
DMARC: policy and reporting
DMARC is a TXT record at _dmarc.yourdomain. A message passes DMARC when SPF or DKIM passes and the domain that passed matches the From domain. That match is called alignment.
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"p=is the policy:none(only report),quarantine(treat as spam) orreject(refuse the message).rua=is where receivers send aggregate reports: XML summaries of who sent mail as your domain and whether it passed.adkim=andaspf=set alignment to relaxed (r, the default) or strict (s). Relaxed letsmail.example.comalign withexample.com; strict needs an exact match.
If reports go to an address on a different domain, that domain has to publish a record agreeing to receive them. Many teams use a DMARC reporting service, which tells you exactly what to add.
Step by step: set up all three
- List every sender. Your mailbox provider, your website's contact form, newsletter and invoicing tools, your CRM. A WordPress site can't send mail on its own, so connect an SMTP plugin to a real mailbox and it is covered by that mailbox's records.
- Publish one SPF record that includes every sender.
- Turn on DKIM for each sender that supports it, using their selector and value.
- Publish DMARC with
p=noneand aruaaddress, then wait. - Send a test to a Gmail account and open Show original. SPF, DKIM and DMARC should all show PASS.
- Read the reports for a few weeks. Fix any legitimate sender that fails.
- Move to
p=quarantine, watch again, thenp=rejectonce every legitimate source passes.
; after reviewing reports
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
; when every legitimate sender passes
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com"Check your records with dig
dig +short TXT example.com
dig +short TXT google._domainkey.example.com
dig +short TXT _dmarc.example.com
dig +short MX example.comThe first should show exactly one line starting v=spf1. Replace google with whatever selector your provider uses.
Forwarding and mailing lists
Authentication was designed for direct delivery, so two situations cause failures that aren't your fault:
- Forwarding. When a message is forwarded, it arrives from the forwarder's server, so SPF fails. DKIM usually still passes if the message is unchanged, which keeps DMARC passing.
- Mailing lists. Lists often add a footer or change the subject, which breaks the DKIM signature. Many lists rewrite the From address to avoid this, and some receivers use ARC, a newer standard that preserves the original results.
This is why you read reports before moving to reject: they show which of these affect you.
Google and Yahoo sender requirements
Since 2024, Gmail and Yahoo require authentication from senders. All senders need SPF or DKIM; anyone sending in bulk needs SPF, DKIM and a DMARC record, with the From domain aligned. Bulk marketing mail also needs easy one-click unsubscribe and a low spam complaint rate. The exact thresholds are set by each provider and can change, so check Google's and Yahoo's current sender guidelines if you send newsletters or high volumes.
Common mistakes
- Two SPF records. Merge them into one.
- Over 10 SPF lookups. Remove services you no longer use, or replace includes with
ip4:ranges where the provider publishes fixed addresses. - Jumping straight to
p=reject. You may block your own invoices or newsletters. Start withnone. - Typos in the DKIM key. Copy and paste, never retype.
- Forgetting a sender. Contact forms and billing tools often send as your domain.
- Publishing DMARC without reading the reports. They are the only way to know what passes.
Security notes
- DMARC stops others using your exact domain. It doesn't stop lookalike domains, so train people to check the sender carefully.
- Domains that never send mail should say so:
v=spf1 -alland a DMARC record withp=reject. - Treat your DNS account like your email: two-factor authentication, few people with access.
- If a DKIM key may have been exposed, ask your provider to rotate it and publish the new public key.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| SPF shows PermError | Two SPF records or over 10 lookups | Merge records; reduce includes |
| DKIM fails | Key mistyped, wrong selector, or record not published | Re-copy the provider's value; check with dig |
| DMARC fails but SPF passes | SPF passed for a different domain (not aligned) | Turn on DKIM with your domain, or align the envelope sender |
| Only forwarded mail fails | Forwarding breaks SPF | Make sure DKIM is set up |
| No DMARC reports arrive | Wrong rua address, or external domain not authorised | Fix the address or authorise the receiving domain |
Frequently asked questions
Should I use ~all or -all?
~all is the safer default while you confirm every sender. Once DMARC is at reject, the difference matters less, because DMARC decides what happens.
Do I need DMARC if I'm a small business?
Yes. It is one TXT record, it is required for bulk senders by major mailbox providers, and the reports show if someone is sending as you.
Why does my mail still go to spam when everything passes?
Authentication proves who sent a message, not that recipients want it. Content, sending reputation and complaint rates matter too.
Does every service need its own DKIM key?
Each service signs with its own key and selector, so yes, publish one for every service that sends as your domain.
Next steps
Publish SPF and DKIM, start DMARC at p=none, read the reports, then tighten the policy. That order keeps your own mail flowing while you close the door on impostors.
- Google Workspace vs Premium Email: which business email fits?
- DNS records explained: A, AAAA, CNAME, MX and TXT
- Set up Premium Email and Set up Google Workspace in the docs
- Manage your records on Domains with RemoteGeeks DNS.




