---
title: "SPF records and DNS: How to add them the right way | AutoSPF"
description: "From the outside, email delivery might seem pretty straightforward - simply type, send, and done! But what goes on behind the scenes is totally different."
image: "https://autospf.com/og/blog/spf-records-and-dns-how-to-add-them-the-right-way.png"
canonical: "https://autospf.com/blog/spf-records-and-dns-how-to-add-them-the-right-way/"
---

Quick Answer

From the outside, email delivery might seem pretty straightforward - simply type, send, and done! But what goes on behind the scenes is totally different. We’re not saying that typing and sending aren’t part of the game, but a much more important aspect is to ensure that your email actually reaches its destination, and when it does, it is not flagged as.

SPF records and DNS: How to add them the right way

Your browser does not support the audio element.

[ Download episode](/audio/spf-records-and-dns-how-to-add-them-the-right-way.mp3) 

Share 

[ ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fautospf.com%2Fblog%2Fspf-records-and-dns-how-to-add-them-the-right-way%2F "Share on LinkedIn") [ ](https://twitter.com/intent/tweet?text=SPF%20records%20and%20DNS%3A%20How%20to%20add%20them%20the%20right%20way&url=https%3A%2F%2Fautospf.com%2Fblog%2Fspf-records-and-dns-how-to-add-them-the-right-way%2F "Share on X/Twitter") [ ](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fautospf.com%2Fblog%2Fspf-records-and-dns-how-to-add-them-the-right-way%2F "Share on Facebook") [ ](https://reddit.com/submit?url=https%3A%2F%2Fautospf.com%2Fblog%2Fspf-records-and-dns-how-to-add-them-the-right-way%2F&title=SPF%20records%20and%20DNS%3A%20How%20to%20add%20them%20the%20right%20way "Share on Reddit") [ ](mailto:?subject=SPF%20records%20and%20DNS%3A%20How%20to%20add%20them%20the%20right%20way&body=Check out this article: https%3A%2F%2Fautospf.com%2Fblog%2Fspf-records-and-dns-how-to-add-them-the-right-way%2F "Share via Email") 

![SPF records and DNS](https://media.mailhop.org/autospf/images/2025/09/spf-flattening-2288.jpg) 

From the outside, email delivery might seem pretty straightforward - simply type, send, and done! But what goes on behind the scenes is totally different.

_Per [RFC 7208](https://datatracker.ietf.org/doc/html/rfc7208), SPF evaluation is capped at 10 DNS mechanism lookups and 2 void lookups per check - exceeding either limit produces a `PermError` that fails authentication for every message from the domain._

We’re not saying that typing and sending aren’t part of the game, but a much more important aspect is to ensure that your email actually reaches its destination, and when it does, it is not [flagged as spam](https://pressgazette.co.uk/publishers/digital-journalism/facebook-spam-posts-independent-small-news-publishers/) or seen as suspicious.

To get your emails to reach the recipients’ inboxes, you must authenticate them. One of the first and most basic ways to authenticate your email is by using SPF, or [Sender Policy Framework](/blog/what-is-spf-email-a-guide-to-sender-validation-technology/). This authentication protocol allows you to declare which mail servers are allowed to send emails on your behalf. You do this by adding an SPF record to your domain’s DNS settings. This record simply lists which servers or services are allowed to send email using your domain.

_The SPF record is an important aspect of authentication, so you should know how to add it correctly to your DNS_.

## What is an SPF record and why do you even need it?

An SPF record (Sender Policy Framework record) is a type of [DNS TXT record](https://www.cloudflare.com/learning/dns/dns-records/dns-txt-record/) that helps protect your domain from [email spoofing](https://www.msspalert.com/brief/novel-usps-spoofing-phishing-attack-relies-on-malicious-pdfs). When you add an SPF record to your domain, you’re clearly stating which mail servers are allowed to send emails on your behalf. This means if someone tries to send an email pretending to be you, but from an unauthorized server, it will be blocked. 

![email spoofing](https://media.mailhop.org/autospf/images/2025/09/spf-flattening-4011.jpg) 

Whenever you send an email, the receiving [mail server](https://www.activecampaign.com/glossary/mail-server) checks your SPF record to verify its authenticity. It compares the IP address of the sending server to the list of approved servers in your record. If there’s a match, the email is let in. If not, it may be flagged as spam or rejected.

Without a valid SPF record, even real emails you send can be treated as suspicious. _So, if your domain is used to send email, whether through Gmail, Outlook, marketing tools, or your own servers, setting up an SPF record is a key step to making sure your emails are both trusted and delivered properly._

![SPF record
](https://media.mailhop.org/autospf/images/2025/09/spf-record-example-6407.jpg)

## How to add an SPF record in your DNS?

You’d be surprised to know that in a survey conducted for over 12 million domains, around [56.5% of them had SPF records, and 2.9%](https://arxiv.org/abs/2502.08240?utm) of those records had errors or undefined rules, which ultimately undermined their effectiveness.

Assuming that you don’t want to fall into the same category, we have created a step-by-step guide to help you add an SPF record to your DNS

Here’s how to do it:

### Step 1: Identify all the sending IPs and services

Before you create your SPF record, make a list of every server or service that sends email on behalf of your domain. This list should include all the services or platforms you use, like Gmail (Google Workspace), Microsoft Outlook, Zoho Mail, [CRMs](https://www.ibm.com/think/topics/crm), Mailchimp, HubSpot, etc. 

Keep in mind that if you miss anything, emails from those services might get rejected or land in spam.

![CRMs
](https://media.mailhop.org/autospf/images/2025/09/spf-record-tester-8821.jpg)

### Step 2: Authorize these servers

Now that you’ve listed all the services that send email from your domain, the next step is to allow them in your SPF record. Use [SPF mechanisms](/blog/understanding-spf-mechanisms-a-mx-ip4-and-include/) like ip4: for IPv4 addresses, ip6: for IPv6, a for your domain’s A record, and mx for your mail servers. _For email platforms like Gmail or Mailchimp, use include: (e.g., include:\_spf.google.com)._

While you’re at it, make sure that you keep your record short and stay within SPF’s limit of 10 [DNS lookups](https://www.digicert.com/faq/dns/how-does-dns-lookup-work) to avoid delivery issues.

### Step 3: Create your SPF record

Now that you know which servers you want to allow, you can write your SPF record. Your record should start with v=spf1, followed by the mechanisms like ip4:, include:, or mx, and end with \~all or -all. 

Take this as an example:

```
v=spf1 ip4:203.0.113.25 include:_spf.google.com ~all
```

Use an [SPF flattening tool](/) to simplify long DNS lookups and ensure your SPF record stays within the 10-lookup limit.

![DNS settings
](https://media.mailhop.org/autospf/images/2025/09/spf-validator-5577.jpg)

### Step 4: Add the record to your DNS settings

Log in to your domain provider’s account and open the [DNS settings](https://www.ntchosting.com/encyclopedia/dns/settings/) for your domain. There, you’ll find an option to add a new TXT record. In the name or host field, type @ if you want to apply it to your main domain, or use a subdomain if needed. Then, in the value field, paste your full SPF record. _Save the changes. Just make sure you have only one SPF record; if you use more than one service, combine everything into a single line._

### Step 5: Check if it’s working properly 

You can’t just publish your [SPF record](/blog/spf-records-in-dns-a-complete-guide-for-email-security/) and let it be. Make sure that you take time to verify it and check that everything is working properly. To do this, you can use any free SPF record checker available online. 

If you still need help adding the SPF record to your DNS, _v=spf1 ip4:203.0.113.25 include:\_spf.google.com \~all_! [Book a demo](/book-a-demo/) with us today!

## Topics

[ SPF ](/tags/spf/)[ SPF Flattening ](/tags/spf-flattening/)[ SPF Flattening tool ](/tags/spf-flattening-tool/)[ SPF record ](/tags/spf-record/) 

![Vishal Lamba](https://media.mailhop.org/autospf/images/authors/vishal-lamba.jpg) 

[ Vishal Lamba ](/authors/vishal-lamba/) 

Content Specialist

Content Specialist at AutoSPF. Writes vendor-specific SPF configuration guides and troubleshooting walkthroughs.

[LinkedIn Profile →](https://www.linkedin.com/in/vishal-lamba/) 

## Ready to get started?

Try AutoSPF free — no credit card required.

[ Book a Demo ](/book-a-demo/) 

## Related Articles

[  Intermediate 3m  3 points to consider before setting your SPF record to -all (HardFail)  May 22, 2025 ](/blog/3-points-to-consider-before-setting-your-spf-record-hardfail/)[  Intermediate 6m  6 Best practices for maintaining an SPF record  Jun 5, 2025 ](/blog/6-best-practices-for-maintaining-an-spf-record/)[  Intermediate 6m  Your SPF record is broken- What does it mean and how do you fix it?  Jan 16, 2025 ](/blog/broken-spf-record-meaning-and-how-to-fix-it/)[  Intermediate 6m  Broken SPF record- What does it mean and how to fix it!  Mar 13, 2025 ](/blog/broken-spf-record-what-does-it-mean-and-how-to-fix-it/)

```json
{"@context":"https://schema.org","@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com","logo":{"@type":"ImageObject","url":"https://autospf.com/images/autospf-logo.png"},"description":"Automatic SPF flattening and email authentication management. Resolve SPF lookup limits, flatten SPF records, and maintain email deliverability across all your domains.","parentOrganization":{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138883901","name":"DuoCircle LLC","url":"https://www.duocircle.com","sameAs":["https://www.wikidata.org/wiki/Q138883901","https://www.crunchbase.com/organization/duocircle-llc","https://www.linkedin.com/company/duocircle","https://github.com/duocircle"],"subOrganization":[{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138898167","name":"DMARC Report","url":"https://dmarcreport.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897912","name":"Phish Protection","url":"https://www.phishprotection.com"}]},"sameAs":["https://www.wikidata.org/wiki/Q138897474","https://www.linkedin.com/company/autospf","https://x.com/autospf01","https://www.g2.com/products/autospf/reviews"],"contactPoint":{"@type":"ContactPoint","contactType":"customer support","url":"https://autospf.com/contact-us/"},"knowsAbout":["SPF Record Flattening","Sender Policy Framework","Email Authentication","DNS Management","DMARC","DKIM"]}
```

```json
{"@context":"https://schema.org","@type":"WebSite","name":"AutoSPF","url":"https://autospf.com","description":"Automatic SPF flattening and email authentication management. Resolve SPF lookup limits, flatten SPF records, and maintain email deliverability across all your domains.","publisher":{"@type":"Organization","name":"AutoSPF","url":"https://autospf.com","logo":{"@type":"ImageObject","url":"https://autospf.com/images/autospf-logo.png"},"description":"Automatic SPF flattening and email authentication management. Resolve SPF lookup limits, flatten SPF records, and maintain email deliverability across all your domains.","parentOrganization":{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138883901","name":"DuoCircle LLC","url":"https://www.duocircle.com","sameAs":["https://www.wikidata.org/wiki/Q138883901","https://www.crunchbase.com/organization/duocircle-llc","https://www.linkedin.com/company/duocircle","https://github.com/duocircle"],"subOrganization":[{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138898167","name":"DMARC Report","url":"https://dmarcreport.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897912","name":"Phish Protection","url":"https://www.phishprotection.com"}]}}}
```

```json
{"@context":"https://schema.org","@type":"BlogPosting","headline":"SPF records and DNS: How to add them the right way","description":"From the outside, email delivery might seem pretty straightforward - simply type, send, and done! But what goes on behind the scenes is totally different.","url":"https://autospf.com/blog/spf-records-and-dns-how-to-add-them-the-right-way/","datePublished":"2025-09-10T18:23:33.000Z","dateModified":"2026-04-18T02:36:41.000Z","dateCreated":"2025-09-10T18:23:33.000Z","author":{"@type":"Person","@id":"https://autospf.com/authors/vishal-lamba/#person","name":"Vishal Lamba","url":"https://autospf.com/authors/vishal-lamba/","jobTitle":"Content Specialist","description":"Vishal Lamba writes AutoSPF's how-to guides and vendor-specific configuration walkthroughs. His work focuses on step-by-step implementation guides for major email platforms (Google Workspace, Microsoft 365, SendGrid, Mimecast, Proofpoint, Brevo, and others), troubleshooting common SPF errors, and translating RFC-level specifications into practical deployment procedures for IT administrators.","image":"https://media.mailhop.org/autospf/images/authors/vishal-lamba.jpg","knowsAbout":["SPF Vendor Configuration","Email Platform Integrations","SPF Troubleshooting","Technical Documentation","Step-by-Step Guides"],"worksFor":{"@type":"Organization","name":"AutoSPF","url":"https://autospf.com"},"sameAs":["https://www.linkedin.com/in/vishal-lamba/"]},"publisher":{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com","logo":{"@type":"ImageObject","url":"https://autospf.com/images/autospf-logo.png"},"description":"Automatic SPF flattening and email authentication management. Resolve SPF lookup limits, flatten SPF records, and maintain email deliverability across all your domains.","parentOrganization":{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138883901","name":"DuoCircle LLC","url":"https://www.duocircle.com","sameAs":["https://www.wikidata.org/wiki/Q138883901","https://www.crunchbase.com/organization/duocircle-llc","https://www.linkedin.com/company/duocircle","https://github.com/duocircle"],"subOrganization":[{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138898167","name":"DMARC Report","url":"https://dmarcreport.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897474","name":"AutoSPF","url":"https://autospf.com"},{"@type":"Organization","@id":"https://www.wikidata.org/wiki/Q138897912","name":"Phish Protection","url":"https://www.phishprotection.com"}]},"sameAs":["https://www.wikidata.org/wiki/Q138897474","https://www.linkedin.com/company/autospf","https://x.com/autospf01","https://www.g2.com/products/autospf/reviews"],"contactPoint":{"@type":"ContactPoint","contactType":"customer support","url":"https://autospf.com/contact-us/"},"knowsAbout":["SPF Record Flattening","Sender Policy Framework","Email Authentication","DNS Management","DMARC","DKIM"]},"mainEntityOfPage":{"@type":"WebPage","@id":"https://autospf.com/blog/spf-records-and-dns-how-to-add-them-the-right-way/"},"articleSection":"intermediate","keywords":"SPF, SPF Flattening, SPF Flattening tool, SPF record","wordCount":883,"image":{"@type":"ImageObject","url":"https://media.mailhop.org/autospf/images/2025/09/spf-flattening-2288.jpg","caption":"SPF records and DNS","width":900,"height":600},"speakable":{"@type":"SpeakableSpecification","cssSelector":[".answer-block","h1"]}}
```

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://autospf.com/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https://autospf.com/blog/"},{"@type":"ListItem","position":3,"name":"Intermediate","item":"https://autospf.com/intermediate/"},{"@type":"ListItem","position":4,"name":"SPF records and DNS: How to add them the right way","item":"https://autospf.com/blog/spf-records-and-dns-how-to-add-them-the-right-way/"}]}
```
