Check a site
Check a website Service status Outages Blog
Theme
All tools
Check a websiteBrowse all tools
UtiBox guide card: a practical how-to with free UtiBox checks

Guides

How to set up SPF, DKIM and DMARC to improve email deliverability

Posted Jimel S.4 min read

A step-by-step guide to publishing SPF, DKIM and DMARC records for your domain. It covers a safe rollout from monitoring to enforcement, and how to check that each record works.

Illustration: UtiBox

On this page 7 sections
  1. Before you start: list your senders
  2. Step 1: publish an SPF record
  3. Step 2: set up DKIM signing
  4. Step 3: publish DMARC in monitoring mode
  5. Step 4: read reports and fix gaps
  6. Step 5: move toward enforcement
  7. Check your work

By the end of this guide you will have SPF, DKIM and DMARC records published for your domain, and a safe way to tighten them over time. These three DNS-based checks let receiving mail servers confirm that a message really comes from you. Without them, legitimate mail is more likely to land in spam or be rejected, and anyone can more easily forge your domain.

You need access to your domain's DNS settings and a list of every service that sends email as your domain. That usually means your mailbox provider, a newsletter tool, a helpdesk, a billing system and your website's contact forms.

Before you start: list your senders

  • Write down every system that sends mail using your domain in the From address.
  • For each one, find its documentation for SPF and DKIM setup. Each provider publishes its own values.
  • Decide which address should receive DMARC reports. A mailbox you will actually read, or a reporting service, works well.
  • Look at your current records with the DNS Lookup tool so you do not overwrite anything that already exists.

Step 1: publish an SPF record

SPF is a TXT record on your domain that lists the servers allowed to send mail for it.

  • Check whether your domain already has an SPF record. A domain should have only one, so edit it rather than adding a second.
  • Start the record with the version tag, then add one entry for each sender, using the include value each provider gives you.
  • End the record with an instruction for everything not listed. Many people begin with a softer setting while testing, then move to a stricter one once they trust the list.
  • Save the record and wait for DNS to update.

Watch the lookup limit. According to MxToolbox (opens in a new tab), quoting RFC 7208, an SPF check may use at most 10 DNS lookups, and that count includes include and redirect. Go over it and the check fails. Remove senders you no longer use, and avoid piling up includes.

Step 2: set up DKIM signing

DKIM adds a cryptographic signature to each message. The receiver checks that signature against a public key you publish in DNS.

  • In each sending service, find the option to enable DKIM for your domain. The service generates the key pair and tells you what to publish.
  • Note the selector name. According to RFC 6376 (opens in a new tab), the key is published as a DNS record under the selector, then the label _domainkey, then your domain.
  • Add the record exactly as given. Some providers ask for a TXT record, others for a CNAME pointing to a record they host.
  • Return to the service and run its verify or activate step so it begins signing.
  • Repeat for every sender. Each can use its own selector, so they do not clash.

Long keys can be awkward. Some DNS panels need a long value split into several quoted strings, so follow your DNS host's guidance if a record is rejected.

Step 3: publish DMARC in monitoring mode

DMARC tells receivers what to do when a message fails authentication, and where to send reports. It builds on SPF and DKIM. RFC 7489 (opens in a new tab) defines three policies: none, quarantine and reject.

  • Create a TXT record at _dmarc on your domain.
  • Begin with the policy none, which asks receivers to take no action on failures but still lets reports flow.
  • Add a rua tag with a mailto address for aggregate reports. The RFC's own example is a record with version DMARC1, policy none and a rua mailto address.
  • Publish it, then wait a couple of weeks while reports arrive.

Step 4: read reports and fix gaps

  • Look through the aggregate reports for sources sending as your domain.
  • For each legitimate source that fails, fix its SPF or DKIM setup. Mail passes DMARC when it is aligned, meaning the domain checked matches the domain in the visible From address.
  • Investigate unknown sources. They may be forgotten services, or they may be spoofing.
  • Repeat until your real mail passes consistently.

Step 5: move toward enforcement

  • Change the policy from none to quarantine, so failing mail is treated as suspicious, usually meaning spam folders.
  • Keep watching reports for a while, and fix anything that breaks.
  • When you are confident, move to reject, which asks receivers to refuse failing mail.
  • Keep the records up to date when you add or retire a sending service.

Bulk senders face extra pressure. Vendor summaries note that Gmail and Yahoo expect SPF, DKIM and DMARC from high-volume senders, so check the current rules in Google's and Yahoo's own sender guidelines if you send newsletters at scale.

Check your work

  • Run your domain through the SPF & DMARC Checker to confirm both records exist and are valid.
  • Use the DNS Propagation Checker if a new record does not show up yet.
  • Send a test message to an outside mailbox, open the original headers and look for pass results for SPF, DKIM and DMARC.
  • Confirm you have only one SPF record and that it stays within 10 lookups.
  • Confirm that DMARC reports are arriving at the address you chose.

Sources: IETF RFC 7489, DMARC (opens in a new tab), IETF RFC 6376, DKIM (opens in a new tab), MxToolbox (opens in a new tab)

Related

More from Guides

Most read

Latest

Most read

  1. 01November Patch Tuesday lands on the 10th: what October’s record release tells us19
  2. 02Introducing UtiBox: the Web’s Utility Box2
  3. 03Ivanti Connect Secure zero-days gave attackers root on VPN gateways1
  4. 04“Black October”: attackers raid secrets at cloud and AI developer platforms1

Embed this post

Paste this code into your page. It shows the post as a card that links back here. In WordPress you can also paste the post’s address on a line of its own.

Cookies on UtiBox

UtiBox is free because of ads. Google and its partners use cookies to show, limit and measure ads, Google Analytics, Ahrefs Web Analytics and Microsoft Clarity show us how the site is used, and we use a few essential cookies to run the site.