If your emails frequently land in spam or someone is sending fake messages pretending to be you, your domain may be missing proper email authentication. SPF, DKIM, and DMARC are three DNS-based standards that help receiving mail servers verify legitimate senders and identify messages that attempt to impersonate your domain.

These records are important for businesses, website owners, publishers, and anyone who sends email using a custom domain. This guide explains what each standard does and how to configure them through your domain’s DNS settings.

What Are SPF, DKIM, and DMARC?

SPF, DKIM and DMARC work together to authenticate email and protect domains from spoofing.
Copyright: © Abijita Foundation

SPF (Sender Policy Framework) identifies which mail servers are authorized to send email for your domain. You publish an SPF policy as a DNS TXT record. Receiving servers use it to check whether the sending server is authorized for the envelope-sender domain.

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to outgoing messages. Your email provider signs messages with a private key, while the matching public key is published in DNS. Receiving servers use that public key to verify the signature and check whether the signed parts of the message have changed.

DMARC (Domain-based Message Authentication, Reporting and Conformance) builds on SPF and DKIM. It checks whether at least one authentication method passes and aligns with the domain shown in the message’s visible From address. It also tells receiving servers how to handle messages that fail DMARC and where to send aggregate reports.

READ
How to Use Gmail Offline in Chrome to Read and Send Emails

The three standards work together, but they are not interchangeable. SPF authorizes sending sources, DKIM verifies message signatures, and DMARC applies a policy based on authentication and domain alignment. See Microsoft’s explanation of how email authentication works for more detail.

Why Your Domain Needs Email Authentication

Configuring these records helps protect your domain against spoofing and impersonation. It can also improve email deliverability by helping receiving providers establish whether messages come from authorized sources. Google requires stronger authentication from bulk senders, including SPF, DKIM, and DMARC for senders that send more than 5,000 messages a day to personal Gmail accounts. Read Google’s email sender guidelines for its current requirements.

DMARC reports provide visibility into services sending mail using your domain. They can help identify legitimate services that are not configured correctly as well as unexpected sources that may be attempting to impersonate your organization.

Before You Start

Before changing DNS records, identify every service that sends email using your domain. This may include Google Workspace, Microsoft 365, your website’s contact forms and WordPress notifications, newsletter platforms, transactional email providers, billing systems, and customer-support tools.

You will also need access to your domain’s DNS management panel. This is usually available through your domain registrar, DNS provider such as Cloudflare, or hosting company. Create a dedicated mailbox such as [email protected] to receive reports. Replace example.com in the examples below with your own domain.

Step 1: Configure SPF

Check for an Existing SPF Record

Before creating a record, check whether your domain already has one. You can use a DNS lookup service or run this command from Windows Command Prompt:

nslookup -type=TXT example.com

Look for a TXT record beginning with v=spf1. A domain or subdomain should have only one SPF record. If one already exists, update it rather than publishing another. Multiple SPF records can cause a permanent SPF error.

READ
How to Share Files Between Windows 11 PCs Using Nearby Sharing

Create Your SPF Record

The correct SPF value depends on the services that send mail for your domain. For example, if you use Google Workspace and SendGrid, a record might look like this:

v=spf1 include:_spf.google.com include:sendgrid.net ~all

This is an example, not a universal value. Confirm the exact SPF instructions supplied by each provider and include only services that actually send email for your domain. Google’s SPF setup guide provides provider-specific examples.

The record starts with v=spf1, followed by mechanisms that identify authorized sending sources. The include: entries refer to the providers’ SPF policies. The ending ~all produces a soft-fail result for sources not listed in the record.

Another common ending is -all, which produces a hard-fail result for unauthorized sources. Follow your provider’s recommendation and make sure every legitimate sender is included before tightening the policy. Receiving servers decide how to handle SPF results, and DMARC evaluates SPF together with alignment and DKIM.

Publish the SPF Record

Open your DNS management panel and add or update the record:

  • Type: TXT
  • Name/Host: @ (for the root domain; your DNS provider may use a different convention)
  • Value: Your complete SPF string
  • TTL: Automatic or the value recommended by your DNS provider

Understand SPF’s DNS Lookup Limit

SPF evaluation is limited to 10 DNS-querying terms. Mechanisms and modifiers such as include, a, mx, exists, and redirect can count toward this limit. Nested includes can also add lookups. Exceeding the limit can cause SPF to return a permanent error, so remove services you no longer use and review the complete lookup chain.

READ
GTA VI Fake PC Download Scams Emerge as Domains Surge

Email forwarding can also affect SPF because the forwarding server may not be authorized by the original sender’s SPF record. DKIM can help preserve authentication through some forwarding scenarios, provided the message’s signed content is not changed.

Step 2: Configure DKIM

DKIM gives outgoing messages a digital signature that receiving servers can verify. Your email provider normally generates the keys and tells you which DNS records to publish.

Generate Your DKIM Record

Sign in to your email provider’s administration panel and locate its DKIM or email-authentication settings. Google Workspace administrators can use the Gmail email-authentication settings in the Admin console. Microsoft 365 administrators can find DKIM configuration in the Microsoft Defender portal. Other providers commonly use labels such as domain authentication or sender authentication.

Your provider will supply a selector and DNS record details. Choose a 2048-bit RSA key when the provider supports it. Follow the provider’s current instructions because the exact record format and setup screens can change.

Add the DKIM Record to DNS

A typical DKIM TXT record may use a hostname such as google._domainkey and a value beginning with v=DKIM1; k=rsa; p=. The long value after p= is the public key generated by your provider. Some services use CNAME records instead, so publish the record type and values your provider supplies.

Be careful when entering the hostname. Some DNS panels automatically append your domain name. Also, never publish or share the DKIM private key. Only the public key belongs in DNS.

READ
How to Back Up an iPhone to a Windows PC

Enable DKIM Signing

Publishing the DNS record is not enough. Return to your email provider’s administration panel and enable DKIM signing. Wait for DNS propagation if the provider cannot immediately verify the record, then confirm that signing is active.

Repeat the process for every service that sends email using your domain. Multiple DKIM selectors are normal when different providers sign messages independently. Google’s DKIM setup guide explains its key-generation and verification process.

Step 3: Configure DMARC

DMARC connects SPF and DKIM authentication with the domain displayed in the sender’s From address. A message passes DMARC when at least one of these conditions is met:

  • SPF passes and the authenticated SPF domain aligns with the visible From domain.
  • DKIM passes and the signing domain aligns with the visible From domain.

This alignment requirement matters because a message can pass SPF or DKIM checks without proving that it belongs to the domain shown to the recipient. Microsoft’s DMARC configuration documentation explains how the checks and alignment work.

Understand the Three DMARC Policies

DMARC supports three main policies:

  • p=none — Monitoring only. It asks receiving servers not to quarantine or reject messages because of DMARC failure, while allowing reports to be collected.
  • p=quarantine — Requests that failing messages be treated as suspicious, commonly by placing them in spam or junk folders.
  • p=reject — Requests that receiving servers reject messages that fail DMARC.

Start with p=none so you can identify legitimate sending services before enforcing a stricter policy.

READ
Your Laptop's RAM and CPU Might Not Be Genuine

Publish a Starter DMARC Record

Create this DNS TXT record:

  • Type: TXT
  • Name/Host: _dmarc
  • Value: v=DMARC1; p=none; rua=mailto:[email protected]; adkim=r; aspf=r; pct=100

Replace the reporting address with a mailbox you control. The rua tag specifies where aggregate reports should be sent. The adkim=r and aspf=r tags use relaxed alignment, while pct=100 applies the requested policy to all messages covered by the record.

DMARC aggregate reports are commonly delivered as compressed XML files. A reporting service can turn them into dashboards that show which sources are sending mail using your domain and whether authentication is passing. If you send reports to an address hosted on another domain, additional DNS authorization may be required.

Review Reports Before Enforcing DMARC

Review reports to identify legitimate services that are failing SPF or DKIM, unknown sources attempting to use your domain, and sending systems that have not been included in your configuration. Fix legitimate authentication problems before changing the policy.

Once you understand your sending sources and have confirmed that legitimate messages authenticate correctly, move gradually from p=none to p=quarantine and eventually p=reject. The optional pct tag can be used to phase in a quarantine or reject policy. Do not move directly to rejection without reviewing reports, because misconfigured services may have their messages rejected by receiving providers.

Protect Your Subdomains

DMARC supports an sp tag that specifies the policy for subdomains. For example, sp=reject requests rejection for messages failing DMARC from subdomains when the parent domain’s policy is used. Without a separate sp tag, subdomains inherit the parent domain’s DMARC policy. Review the email use of each subdomain before applying a strict policy.

READ
How to Back Up and Restore WhatsApp Chats on Android

Step 4: Test Your Email Authentication

Testing SPF, DKIM and DMARC records helps verify that a domain’s email authentication is correctly configured.
Copyright: © Abijita Foundation

After publishing SPF, DKIM, and DMARC, send a test message from your domain to a Gmail account. Open the message, select the three-dot menu, and choose Show original. Check the authentication results for SPF: PASS, DKIM: PASS, and DMARC: PASS.

You can also use tools such as MXToolbox to inspect DNS records, Mail-Tester to review a test message, and Google Admin Toolbox for DNS and email checks.

Test every service that sends email for your domain, including website notifications, newsletters, billing systems, and transactional messages. A successful test from one mailbox does not guarantee that every other sending service is configured correctly.

Common SPF, DKIM, and DMARC Mistakes

  • Creating multiple SPF records: Keep one SPF record for each domain or subdomain and combine the authorized sending sources into it.
  • Exceeding the SPF lookup limit: Review nested includes and remove unnecessary services.
  • Forgetting website emails: Contact forms, WordPress notifications, and automated messages may use different sending servers from your main mailbox.
  • Publishing DKIM without enabling signing: The DNS record alone does not activate DKIM. Enable signing through your provider.
  • Ignoring DMARC alignment: SPF and DKIM can pass individually while DMARC fails if their authenticated domains do not align with the visible From domain.
  • Enforcing DMARC too early: Review authentication reports before switching to quarantine or rejection.
  • Ignoring subdomains: Review which subdomains send email and apply appropriate authentication policies.
  • Never reviewing reports: DMARC reports help identify unauthorized sending sources and configuration problems.

Frequently Asked Questions

Do I need SPF, DKIM, and DMARC?

Yes. They provide complementary protection. SPF authorizes sending sources, DKIM verifies message signatures, and DMARC checks authentication results and domain alignment. Major mailbox providers also have specific requirements for bulk senders.

READ
How to Use Gmail Offline in Chrome to Read and Send Emails
How long does DNS configuration take?

Changes may become visible within minutes, but allow up to 48 hours for propagation depending on your DNS provider and TTL settings. DMARC enforcement should take longer because you need to review reports before tightening the policy.


Buy ExpressVPN with PayPal or Credit Card
Will SPF, DKIM, and DMARC stop all phishing emails?

No. They help prevent attackers from spoofing your exact domain, but they cannot stop every phishing attempt. Look-alike domains, compromised email accounts, and messages sent through legitimate but abused services can still be used for phishing. Read our report on a phishing campaign using fake Microsoft 365 outage alerts to see how attackers exploit trusted-looking email messages.

Can I configure these records with a free Gmail or Outlook address?

You need control over a custom domain’s DNS settings to publish your own SPF, DKIM, and DMARC records. Free Gmail and Outlook.com addresses are authenticated through their respective providers.

Can I use multiple DKIM records?

Yes. Multiple DKIM selectors are normal when different email providers or services sign messages using your domain. Each service should use the records supplied by its provider.

Advertisement