How-to guides

How to set up SPF, DKIM and DMARC

SPF, DKIM and DMARC tell mailbox providers which services may send email for your domain and prove your messages are genuine. Without them, emails land in spam and others can impersonate you. Here is how to set them up step by step.

What each record does

  • SPF (Sender Policy Framework) lists the servers and services allowed to send email for your domain. It is a TXT record on your domain.
  • DKIM (DomainKeys Identified Mail) adds a digital signature to each message. The receiving server checks it against a public key published in your DNS.
  • DMARC (Domain-based Message Authentication, Reporting and Conformance) tells receivers what to do when a message fails SPF and DKIM alignment, and sends you reports about who is sending as your domain.

Before you start

Make a list of every service that sends email using your domain: your mailbox provider such as Google Workspace or Microsoft 365, your website or online store, newsletter tools, CRM, help desk, invoicing and booking software. Each one needs to be authenticated.

You will also need access to your domain's DNS settings, usually at your domain registrar or DNS provider.

Step 1: Set up SPF

  1. Find the SPF include value for each sending service in its documentation.
  2. Create one TXT record on your root domain starting with v=spf1, followed by the includes, and ending with ~all or -all.
  3. Keep the record under the limit of 10 DNS lookups; too many includes cause SPF to fail.

Step 2: Set up DKIM

  1. In each sending service, find the DKIM or domain authentication settings.
  2. Generate a key if needed, and add the records the service gives you, usually TXT or CNAME records under a selector name.
  3. Turn on signing in the service and send a test message.
  4. Check the message headers: DKIM should show pass, signed by your domain.

Step 3: Publish DMARC in monitoring mode

Add a TXT record at _dmarc.yourdomain with a policy of p=none and a reporting address, for example rua=mailto:dmarc-reports@yourdomain. This changes nothing about delivery but starts sending you aggregate reports.

Step 4: Read reports and fix senders

Reports arrive as XML files, which are easier to read with a DMARC reporting tool. Look for legitimate services that fail and fix their SPF or DKIM setup. Look for unknown sources, which may be spoofing.

Step 5: Move to enforcement

When all legitimate email passes, change the policy to p=quarantine, then to p=reject after a period without problems. You can use the pct tag to apply the policy gradually.

Extra requirements for bulk senders

If you send large volumes to Gmail or Yahoo addresses, you also need one-click unsubscribe in marketing emails and a low spam complaint rate, alongside SPF, DKIM and DMARC.

Common mistakes

  • Two SPF records on the same domain.
  • Forgetting a tool, such as the invoicing system, which then fails DMARC.
  • Jumping straight to p=reject without monitoring.
  • Not authenticating subdomains used for marketing email.

How we help

We map every service sending as your domain, set up SPF, DKIM and DMARC, monitor reports and move you to enforcement safely, so your emails reach inboxes and nobody can send as you.

Questions, answered

Yes. Gmail and Yahoo require SPF and DKIM for senders, and bulk senders must also publish a DMARC policy. Together they give the best deliverability and protection against spoofing.

No. A domain must have only one SPF record. If you use several services, combine them in one record with several include statements.

It can, if a service sending for you is not authenticated. That is why you start with p=none, read the reports, fix every legitimate sender, and only then move to quarantine and reject.

Keep exploring

Where to go next.