What is an SPF and DKIM record, why do I need them, and how do I set them up?

Print article Email to friend
0.00

To learn how to use spf records to check whether an email you received is legitimate click here

For the standard version read below.
For those that want an even easier version that anyone can understand click here

 

What is an SPF and DKIM record, why do I need them, and how do I set them up?

SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) are email security records that help prove your emails are genuine and have not been tampered with. They are published in your domain's DNS settings and are checked by receiving mail servers whenever you send an email.

Without these records, your emails are more likely to be marked as spam, rejected, or used by scammers pretending to send email from your domain.

What is SPF?

SPF is a DNS record that lists the mail servers authorised to send email on behalf of your domain.

When you send an email, the receiving mail server checks your domain's SPF record to see whether the sending server is authorised. If it is, the SPF check passes. If it is not, the email may be treated as suspicious.

Example:

A scammer attempts to send an email using your email address.

Although they can place your address in the "From" field, they are sending from an unauthorised server. When the recipient's mail server checks your SPF record, it sees that the scammer's server is not approved and can reject the email or move it to spam.

What is DKIM?

DKIM works differently. Instead of authorising servers, it digitally signs outgoing emails.

When a message leaves your mail server, a unique cryptographic signature is added to the email header. The receiving mail server uses the DKIM record published in your DNS to verify that:

  • The email genuinely came from your domain.
  • The message has not been altered during transit.

If the signature cannot be verified, the email may be treated as suspicious.

Why do I need SPF and DKIM?

SPF and DKIM provide several important benefits:

  • Help protect your domain from email spoofing.
  • Improve email deliverability.
  • Reduce the likelihood of emails being marked as spam.
  • Increase trust with recipients.
  • Support modern email security standards such as DMARC.

Most major email providers, including Microsoft 365, Google Workspace, Outlook.com and Gmail, expect domains to have SPF and DKIM configured correctly.

How do I set them up?

Setting up SPF
  1. Identify every service that sends email using your domain, such as:

    • Your web hosting provider
    • Microsoft 365
    • Google Workspace
    • QuickBooks
    • Mailchimp
    • Xero
    • CRM and marketing platforms
  2. Log in to your DNS management panel.

  3. Create or edit your SPF TXT record.

A Microsoft 365 SPF record typically looks similar to:

 v=spf1 include:spf.protection.outlook.com -all
 

If you use additional services, their authorised servers must also be included.

Setting up DKIM
  1. Enable DKIM within your email service.
  2. The provider will generate one or more DNS records.
  3. Add the supplied CNAME or TXT records to your DNS zone.
  4. Once DNS has updated, activate DKIM within the provider's control panel.

For Microsoft 365, DKIM is usually enabled in the Microsoft Defender or Exchange administration settings after the required DNS records have been added.

A practical example

Suppose you run a business and use QuickBooks to email invoices.

Without updating your SPF record, an invoice sent from QuickBooks may fail authentication because QuickBooks' servers are not listed as authorised senders for your domain.

By adding the QuickBooks SPF entry to your DNS records and enabling DKIM where available, recipient mail servers can verify that QuickBooks is authorised to send on your behalf, improving the chances that invoices are delivered successfully.

Summary

  • SPF tells the world which servers are allowed to send email for your domain.
  • DKIM proves that an email really came from your domain and has not been modified.
  • Both records help prevent spoofing and improve email delivery.
  • They are configured in your domain's DNS settings.
  • Most businesses should also implement DMARC, which works alongside SPF and DKIM to tell receiving mail servers what to do when authentication checks fail.

 

 

How do I check if SPF and DKIM are working?

There are two simple ways to verify that SPF and DKIM are working correctly.

Method 1: Check an Email Header (Recommended)

Send a test email from your domain to a Gmail, Outlook, or other mailbox you can access.

Open the received email and view the message headers. You should look for lines similar to:

Authentication-Results:
 
spf=pass
dkim=pass
dmarc=pass
``

If you see SPF=pass and DKIM=pass, the authentication checks have succeeded and are working correctly.

For example:

 
Authentication-Results:
spf=pass
dkim=pass
dmarc=pass
 

This means:

  • SPF verified the sending server ✅
  • DKIM verified the message signature ✅
  • DMARC verified the overall authentication policy ✅

 

Method 2: Check Your DNS Records

You can verify that the records exist by using online DNS lookup tools.

For SPF:
yourdomain.com

You should see something similar to:
v=spf1 include:spf.protection.outlook.com -all
 
For DKIM, the exact record depends on your email provider, but the selector often looks similar to:
selector1._domainkey.yourdomain.com
 

and should return a valid DKIM record.

Common Signs Something Is Wrong

SPF Problems

  • Emails go to spam.
  • SPF shows "fail" in headers.
  • You are sending from a service (QuickBooks, Mailchimp, website forms, etc.) that is not included in your SPF record.

DKIM Problems

  • DKIM shows "fail" or "none".
  • The DNS record is missing.
  • DKIM has not been enabled in your mail provider after publishing the DNS record.

The Best Test

The best real-world test is:

  1. Send an email from your domain.
  2. Receive it in another mailbox.
  3. Open the headers.
  4. Confirm:
    • SPF = Pass
    • DKIM = Pass
    • DMARC = Pass

If all three pass, your email authentication is generally configured correctly.

What is an SPF and DKIM record, why do I need them, and how do I set them up?

To learn how to use spf records to check whether an email you received is legitimate click here

For the standard version read below.
For those that want an even easier version that anyone can understand click here

 

What is an SPF and DKIM record, why do I need them, and how do I set them up?

SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail) are email security records that help prove your emails are genuine and have not been tampered with. They are published in your domain's DNS settings and are checked by receiving mail servers whenever you send an email.

Without these records, your emails are more likely to be marked as spam, rejected, or used by scammers pretending to send email from your domain.

What is SPF?

SPF is a DNS record that lists the mail servers authorised to send email on behalf of your domain.

When you send an email, the receiving mail server checks your domain's SPF record to see whether the sending server is authorised. If it is, the SPF check passes. If it is not, the email may be treated as suspicious.

Example:

A scammer attempts to send an email using your email address.

Although they can place your address in the "From" field, they are sending from an unauthorised server. When the recipient's mail server checks your SPF record, it sees that the scammer's server is not approved and can reject the email or move it to spam.

What is DKIM?

DKIM works differently. Instead of authorising servers, it digitally signs outgoing emails.

When a message leaves your mail server, a unique cryptographic signature is added to the email header. The receiving mail server uses the DKIM record published in your DNS to verify that:

  • The email genuinely came from your domain.
  • The message has not been altered during transit.

If the signature cannot be verified, the email may be treated as suspicious.

Why do I need SPF and DKIM?

SPF and DKIM provide several important benefits:

  • Help protect your domain from email spoofing.
  • Improve email deliverability.
  • Reduce the likelihood of emails being marked as spam.
  • Increase trust with recipients.
  • Support modern email security standards such as DMARC.

Most major email providers, including Microsoft 365, Google Workspace, Outlook.com and Gmail, expect domains to have SPF and DKIM configured correctly.

How do I set them up?

Setting up SPF
  1. Identify every service that sends email using your domain, such as:

    • Your web hosting provider
    • Microsoft 365
    • Google Workspace
    • QuickBooks
    • Mailchimp
    • Xero
    • CRM and marketing platforms
  2. Log in to your DNS management panel.

  3. Create or edit your SPF TXT record.

A Microsoft 365 SPF record typically looks similar to:

 v=spf1 include:spf.protection.outlook.com -all
 

If you use additional services, their authorised servers must also be included.

Setting up DKIM
  1. Enable DKIM within your email service.
  2. The provider will generate one or more DNS records.
  3. Add the supplied CNAME or TXT records to your DNS zone.
  4. Once DNS has updated, activate DKIM within the provider's control panel.

For Microsoft 365, DKIM is usually enabled in the Microsoft Defender or Exchange administration settings after the required DNS records have been added.

A practical example

Suppose you run a business and use QuickBooks to email invoices.

Without updating your SPF record, an invoice sent from QuickBooks may fail authentication because QuickBooks' servers are not listed as authorised senders for your domain.

By adding the QuickBooks SPF entry to your DNS records and enabling DKIM where available, recipient mail servers can verify that QuickBooks is authorised to send on your behalf, improving the chances that invoices are delivered successfully.

Summary

  • SPF tells the world which servers are allowed to send email for your domain.
  • DKIM proves that an email really came from your domain and has not been modified.
  • Both records help prevent spoofing and improve email delivery.
  • They are configured in your domain's DNS settings.
  • Most businesses should also implement DMARC, which works alongside SPF and DKIM to tell receiving mail servers what to do when authentication checks fail.

 

 

How do I check if SPF and DKIM are working?

There are two simple ways to verify that SPF and DKIM are working correctly.

Method 1: Check an Email Header (Recommended)

Send a test email from your domain to a Gmail, Outlook, or other mailbox you can access.

Open the received email and view the message headers. You should look for lines similar to:

Authentication-Results:
 
spf=pass
dkim=pass
dmarc=pass
``

If you see SPF=pass and DKIM=pass, the authentication checks have succeeded and are working correctly.

For example:

 
Authentication-Results:
spf=pass
dkim=pass
dmarc=pass
 

This means:

  • SPF verified the sending server ✅
  • DKIM verified the message signature ✅
  • DMARC verified the overall authentication policy ✅

 

Method 2: Check Your DNS Records

You can verify that the records exist by using online DNS lookup tools.

For SPF:
yourdomain.com

You should see something similar to:
v=spf1 include:spf.protection.outlook.com -all
 
For DKIM, the exact record depends on your email provider, but the selector often looks similar to:
selector1._domainkey.yourdomain.com
 

and should return a valid DKIM record.

Common Signs Something Is Wrong

SPF Problems

  • Emails go to spam.
  • SPF shows "fail" in headers.
  • You are sending from a service (QuickBooks, Mailchimp, website forms, etc.) that is not included in your SPF record.

DKIM Problems

  • DKIM shows "fail" or "none".
  • The DNS record is missing.
  • DKIM has not been enabled in your mail provider after publishing the DNS record.

The Best Test

The best real-world test is:

  1. Send an email from your domain.
  2. Receive it in another mailbox.
  3. Open the headers.
  4. Confirm:
    • SPF = Pass
    • DKIM = Pass
    • DMARC = Pass

If all three pass, your email authentication is generally configured correctly.