Table of contents
Get insights delivered straight into your inbox every week!

SPF Record Setup: 5 Steps

To protect your domain from phishing and spoofing, setting up an SPF (Sender Policy Framework) record is essential. An SPF record ensures only authorized servers can send emails on your behalf, improving email deliverability and reducing risks. Here’s a quick summary of the process:

  1. Identify Email Sources: List every service or server sending emails for your domain (e.g., Google Workspace, Mailchimp, or transactional email servers).
  2. Understand SPF Syntax: Learn how SPF mechanisms like include, ip4, and qualifiers (~all or -all) define authorized senders.
  3. Access DNS Settings: Log in to your domain registrar or hosting provider to manage DNS records.
  4. Create and Publish: Add a TXT record with your SPF string (e.g., v=spf1 include:_spf.google.com ~all) to your DNS settings.
  5. Verify and Test: Use tools like MXToolbox to confirm your SPF record is live and correctly configured.

Key Tip: Ensure you only have one SPF record per domain by consolidating all authorized senders into a single entry. Misconfigurations can lead to email delivery issues.

This step-by-step approach secures your domain and improves email reliability. For added security, consider combining SPF with DKIM and DMARC protocols.

Step 1: Identify Authorized Email Sending Sources

Start by listing every service and server that sends emails using your domain. This step is critical - it ensures your SPF record protects your domain without accidentally blocking legitimate emails. If you miss even one authorized sender, their emails could fail SPF authentication, ending up in spam folders or being rejected entirely.

Common Email-Sending Sources to Include

Organizations typically rely on a mix of email-sending sources. Each one must be identified and authorized:

  • In-office mail servers: These include platforms like Google Workspace or Microsoft 365, which handle day-to-day business emails.
  • Third-party email service providers: These services, like Mailchimp or HubSpot, send emails for specific tasks like marketing campaigns. CRM systems such as Salesforce or outreach tools like Salesforge also fall into this category.
  • Web servers: These handle transactional emails, including password resets, order confirmations, and shipping updates from your website's infrastructure.
  • ISP mail servers: If you use email services provided by your internet service provider, these may also need to be documented.
  • Specialized email infrastructure: Tools like Primeforge simplify SPF setup for platforms like Google Workspace or Microsoft 365. Other services, such as Mailforge or Infraforge, also manage email sending and should be included.

Gathering the Necessary Information

To compile a complete list of email sources, consult your IT team, review your service subscriptions, and check existing DNS records. Keep in mind that different departments may use their own tools for email-related tasks - marketing teams might rely on automation platforms, sales teams on outreach tools, and customer service teams on ticketing systems that send automated responses.

Domains vs. IP Addresses: What to Document

Decide whether each sender requires a domain-based or IP-based entry in your SPF record:

  • Domain-based authorization: This uses the "include:" tag. For example, Google Workspace provides _spf.google.com, which you reference as include:_spf.google.com. This method is flexible, as email providers can update their infrastructure without requiring changes to your SPF record.
  • IP-based authorization: This uses "ip4:" for IPv4 addresses or "ip6:" for IPv6 addresses. It's commonly used for in-house mail servers or ISP mail servers.

Most modern email providers prefer domain-based authorization. Services like Primeforge automatically configure SPF records for platforms like Google Workspace and Microsoft 365, reducing the chance of manual errors.

Create a Sender Inventory Spreadsheet

Organize your findings in a spreadsheet. For each sender, include:

  • Service name
  • Purpose (e.g., marketing, transactional emails)
  • Address (domain or IP)
  • Authorization type (domain-based or IP-based)
  • Recommended SPF syntax

This inventory will be essential when you build your SPF record in Step 4. It also helps you avoid a common mistake - creating multiple SPF records for a single domain, which results in a PermError and causes emails to be flagged as spam.

Handling Multiple Domains

SPF records are only needed for domains that send emails. If a domain is used solely for a landing page or redirect, it doesn’t require SPF configuration. However, every domain that sends emails must have its own SPF record. You cannot create multiple SPF records for a single domain; instead, consolidate all authorized senders into one record.

Double-Check Your Inventory

Before moving to the next step, review your sender list. Ensure you’ve accounted for all email services, marketing platforms, and communication tools. If you use managed email services like Google Workspace or Microsoft 365 through providers like Primeforge, confirm whether they automatically publish SPF records for you. Primeforge, for example, handles SPF setup for each mailbox, simplifying the process and reducing potential errors.

With your sender inventory complete and verified, you’ll have a solid foundation for building your SPF record in Step 4. Next, dive into understanding SPF syntax in Step 2.

Step 2: Understand SPF Record Syntax

SPF records are structured to define which email sources are authorized to send messages on behalf of your domain. By understanding this syntax, you can create a record that protects your domain while ensuring legitimate emails aren't blocked.

Starting Point: v=spf1

Every SPF record begins with v=spf1, which identifies it as SPF version 1. Without this tag, mail servers won't recognize the record as a valid SPF policy.

Key SPF Mechanisms

Mechanisms are the core components that specify which servers are allowed to send emails for your domain. Here's a breakdown:

  • ip4: Authorizes specific IPv4 addresses or ranges. For example, ip4:192.0.2.0/24 allows all addresses in that subnet. This is often used for internal mail servers or IPs provided by your ISP.
  • ip6: Similar to ip4, but for IPv6 addresses.
  • include: References another domain's SPF record to authorize third-party mail servers. For instance, include:_spf.google.com tells mail servers to check Google's SPF record for authorized servers. Keep in mind, you can use up to 10 include tags in a single SPF record.
  • a: Authorizes the domain's A record (used for mapping domain names to IP addresses) for email sending. This is useful if your web server also sends emails.
  • mx: Authorizes the domain's MX (mail exchange) records. This is helpful when your mail exchange servers also handle outbound emails.

These mechanisms provide the foundation for defining authorized email sources. Next, let's look at how qualifiers adjust these rules.

Qualifiers: Soft Fail vs. Hard Fail

Qualifiers determine how receiving servers handle emails that fail SPF checks:

  • ~all (soft fail): Marks emails from unauthorized servers as suspicious but still delivers them. This is a flexible option that allows you to monitor issues without blocking legitimate emails.
  • -all (hard fail): Rejects emails from any server not listed in the SPF record. Use this stricter setting only after thoroughly testing your configuration to avoid blocking valid emails.

Common SPF Record Examples

Different email providers require specific SPF configurations. Here are a few examples:

  • Google Workspace only:
    v=spf1 include:_spf.google.com ~all
  • Zoho Mail:
    v=spf1 include:zohomail.com ~all
  • Generic setup with IP addresses:
    v=spf1 a mx ip4:xxx.xxx.xxx.xxx -all

While the core structure - starting with v=spf1 and ending with a qualifier - remains consistent, the mechanisms vary depending on your email provider.

Using Multiple Email Services

If you use multiple email providers, you'll need to combine their SPF records into one using the include: mechanism. For example, if you use both Google Workspace and a marketing platform, your SPF record might look like this:

v=spf1 include:_spf.google.com include:sendingplatform.com ~all

This record authorizes Google's servers and the marketing platform's servers to send emails on your behalf. It's important to remember that a domain can only have one SPF record. If multiple records exist, emails may fail SPF checks and be marked as spam. Consolidating all authorizations into a single record is essential.

Breaking Down an SPF Record Example

Here’s an example of a complete SPF record:

v=spf1 ip4:192.0.2.0 include:_spf.google.com include:mailchimp.com mx ~all

This record authorizes:

  • The IPv4 address 192.0.2.0
  • Servers listed in Google's SPF record
  • Servers listed in Mailchimp's SPF record
  • The domain's MX records

Emails from sources not matching these criteria will be flagged as suspicious but still delivered due to the soft fail qualifier.

Avoiding Common Syntax Errors

Accuracy is critical when creating SPF records. Simple mistakes - like misspelled mechanisms, missing colons (e.g., after ip4 or include), or extra spaces - can cause the record to fail. Always consult your email provider's documentation for proper syntax.

The One-Record Rule

A domain should have only one SPF record. If you need to authorize multiple sources, combine them into a single record. Multiple SPF records can disrupt email authentication and cause all messages to fail SPF checks.

With this understanding of SPF syntax, you're ready to move forward and configure your DNS settings in Step 3.

Step 3: Access Your DNS Management Console

Now that you're familiar with SPF syntax, the next step is to access the platform where you'll create or update your record. This is typically done through your domain registrar or hosting provider.

Finding Your DNS Management Console

Start by logging into your domain account using your credentials. Once inside, locate the section where your domains are listed, and select the one you need to configure. Look for options labeled "MY DOMAINS", "Domain Management", "DNS Management", "Name Server Management", or "Zone File Settings." Keep in mind that the exact wording and location can vary depending on your provider.

Checking Administrative Access

Make sure you have administrative privileges before attempting any DNS changes. Without the right permissions, you won’t be able to publish the SPF record. If your DNS is managed by an external party, reach out to your IT team or system administrator for assistance. Once you’ve confirmed access, take a moment to review your existing TXT records.

Locating Existing SPF Records

Before adding a new SPF record, it’s crucial to check if one already exists for your domain. According to the Internet Engineering Task Force (IETF), a domain can only have one SPF record. Multiple records can lead to errors and potentially cause your emails to be flagged as spam.

Inspect the TXT records in your DNS management interface. If an SPF record is already present and you need to include additional authorized senders, update the existing record instead of creating a new one. This ensures proper email deliverability. Once you’ve reviewed your records, you can move on to creating or updating your SPF entry.

Understanding DNS Provider Differences

Keep in mind that DNS interfaces differ between providers. Some even offer automated tools for publishing SPF records, especially for popular email services, which can save you time and effort. If you’re unsure how to proceed, consult your provider’s help documentation or contact their support team for guidance.

Automated DNS Setup with Primeforge

Primeforge

For those using Primeforge as part of their email infrastructure, the manual steps involved in DNS setup are greatly reduced. Primeforge automatically configures DMARC, SPF, DKIM, and custom domain tracking for every mailbox you purchase, adhering to industry standards. This automation not only minimizes configuration errors but also speeds up the process - Primeforge typically completes DNS setup in about 30 minutes, compared to the 24 hours or more that manual setup often requires.

"For each mailbox you buy with Primeforge, we take care of setting up DMARC, SPF, DKIM and custom domain tracking, following industry best practices." - Primeforge

If you manage multiple domains, Primeforge also offers bulk DNS updates through its application. This feature allows you to update several domains at once, making it especially helpful for organizations running cold outreach campaigns that require consistent DNS settings across multiple domains.

Preparing for Record Creation

Once you’ve confirmed administrative access and reviewed your existing SPF records, you’re ready to move forward with publishing or updating your SPF record.

Step 4: Create and Publish the SPF Record

With your sender inventory ready and DNS access in hand, it’s time to create and publish your SPF record. This involves adding specific details to your DNS settings to authenticate your email-sending servers.

Adding a New TXT Record

Start by locating the "Add Record" option in your DNS management interface. Select "TXT" as the record type from the dropdown menu. SPF records must be entered as TXT records - other types like A, MX, or CNAME won’t work for email authentication.

Setting the Host/Name Field

The Host/Name field determines where the SPF record will apply. For most organizations, setting this field to "@" ensures the SPF policy applies to emails sent from the root domain (e.g., user@yourdomain.com). If you're configuring SPF for a subdomain, like mail.yourdomain.com, enter the subdomain name instead. Keep in mind that DNS providers may use different labels for this field.

Entering the SPF Record String

The Value field (sometimes labeled "TXT Data" or "Data") is where you paste your SPF record string. Every SPF record must start with "v=spf1" to indicate the SPF version, followed by mechanisms that specify which servers are authorized to send emails on your behalf.

Here are a few examples based on common email services:

  • Google Workspace:
    v=spf1 include:_spf.google.com ~all
    
    This record authorizes Google’s servers to send emails for your domain, with the "~all" qualifier marking unauthorized emails as suspicious.
  • Microsoft 365:
    Similar to Google Workspace, the SPF record will include Microsoft’s SPF domain, formatted like this:
    v=spf1 include:spf.protection.outlook.com ~all
    
  • Multiple Email Services:
    If you use multiple email platforms, such as Google Workspace and a service like SendGrid, your SPF record can include both:
    v=spf1 include:_spf.google.com include:sendgrid.net ~all
    

This setup ensures all specified services are authorized to send emails on behalf of your domain.

Choosing SPF Qualifiers

SPF records typically end with either "~all" or "-all", which dictate how mail servers handle unauthorized emails:

  • ~all (Soft Fail): Marks unauthorized emails as suspicious or spam but still delivers them.
  • -all (Hard Fail): Rejects unauthorized emails outright.

Most organizations start with "~all" to test their setup. Once the record is verified and working as intended, you can switch to "-all" for stricter enforcement.

Setting the TTL Value

The TTL (Time to Live) dictates how long DNS resolvers cache your SPF record before checking for updates. TTL is measured in seconds, with common settings ranging from 3,600 seconds (1 hour) to 86,400 seconds (24 hours).

For new SPF records, a shorter TTL like 3,600 seconds is ideal, as it allows changes to propagate faster. Once the record is stable, you can increase the TTL for efficiency.

Saving and Publishing the Record

After entering all the necessary details - Type: TXT, Host: "@" or your subdomain, Value: your SPF string, and TTL - save your changes. Look for a button labeled "Save", "Publish", "Add Record", or "Update" in your DNS management interface. Once saved, verify that the SPF record appears in your DNS zone file or record list. Some DNS providers may require additional confirmation, like email verification.

Before finalizing, double-check the following:

  • The Host/Name field is correctly set to "@" for your root domain or the specific subdomain.
  • The record type is "TXT."
  • The SPF string is free of typos and begins with "v=spf1" and ends with "~all" or "-all."
  • Any IP addresses or domain includes (e.g., ip4:192.0.2.1 or include:_spf.google.com) are formatted correctly.

Waiting for DNS Propagation

Once published, your SPF record won’t activate immediately. DNS propagation can take anywhere from 15 minutes to 48 hours, depending on factors like your TTL setting and DNS cache refresh rates. To ensure your SPF record is active, wait a few hours before testing its functionality.

Step 5: Verify and Test Your SPF Record

After configuring your SPF record in Step 4, the next crucial step is to verify that it’s working as expected. Testing your SPF record right after publishing it helps identify and correct any syntax errors or configuration issues that might interfere with its functionality.

Using Online SPF Checking Tools

Online tools make it easy to confirm whether your SPF record is properly set up. Popular options like MXToolbox and Google's G Suite Toolbox Check MX are widely recommended for this purpose. Simply enter your domain name into one of these tools, and it will display your SPF record string and validate its syntax. For instance, if you’re using Google Workspace, your SPF record should look something like this:

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

If the tool confirms that your record is valid and live, you can be confident that your TXT record was published correctly in your domain’s DNS. Keep in mind, however, that DNS propagation delays can sometimes affect when changes become visible.

Understanding DNS Propagation Time

DNS propagation can take up to 48 hours, though using a TTL (Time to Live) setting of 300 seconds can speed up the process. Platforms like Primeforge streamline SPF setup and verification, often completing the DNS configuration process in as little as 30 minutes.

Troubleshooting Common Errors

When issues arise, SPF verification tools provide helpful feedback to pinpoint the problem. Here are some common errors and how to address them:

  • PermError: This happens when a domain has multiple SPF records, which is not allowed under Internet Engineering Task Force (IETF) standards. To fix this, combine the records into one, such as:
    v=spf1 include:_spf.google.com include:thirdpartyservice.com ~all
  • Syntax Errors: These occur due to typos, extra spaces, or improperly formatted include tags. Make sure your SPF record begins with v=spf1 and ends with either ~all or -all.

If your SPF record doesn’t appear after propagation, double-check that it was added to the correct location in your DNS management console. Ensure you’re logged into the right domain account, have selected the correct domain, and entered the SPF data as a TXT record. Persistent issues may require assistance from your DNS provider’s support team.

Regularly Monitor Your SPF Record

It’s a good idea to periodically recheck your SPF record, especially when you add new email services or make changes to your infrastructure. Document any updates, including the date and reason for modifications, so you can track changes over time. Monitoring email delivery metrics and spam complaint rates can also help you spot potential issues that may need attention.

Performing quarterly audits of your email authentication setup ensures everything continues to work as intended. A well-maintained SPF record can significantly reduce email spoofing and phishing attempts by up to 50% and 70%, respectively.

Preparing for Email Campaigns

Before launching an email campaign, double-check your SPF verification results. Ensure all authorized senders are included in your record, and if you’re using multiple email services, confirm that all SPF include statements have been merged into a single record.

For added security and better email deliverability, consider implementing other email authentication protocols like DKIM and DMARC. These protocols work alongside SPF to strengthen your email authentication. If you’re using Primeforge, their platform simplifies the setup process by automating SPF, DKIM, and DMARC configurations according to best practices. They also provide support through their Helpdesk or live chat.

With your SPF record verified and functioning properly, you’re ready to move on to the next steps to further secure your email system.

Next Steps

Now that you've completed the five essential steps to set up your SPF record - identifying authorized email sources, understanding SPF syntax, accessing your DNS console, creating and publishing the record, and verifying its functionality - you've built the cornerstone of your email authentication strategy. But this is just the beginning when it comes to improving email deliverability and security.

The benefits of a properly configured SPF record are clear. Organizations that implement SPF correctly report up to a 50% reduction in email spoofing incidents. Additionally, domains with accurate SPF records see up to 70% fewer phishing attempts. These numbers highlight the importance of getting your SPF setup right.

That said, SPF is just one piece of the puzzle. To strengthen your email security further, consider implementing DKIM (DomainKeys Identified Mail), which uses cryptographic signatures to ensure email integrity. Then, layer on DMARC (Domain-based Message Authentication, Reporting, and Conformance). DMARC ties together SPF and DKIM, providing policies for handling authentication failures and detailed reporting to monitor your domain's email activity. Together, SPF, DKIM, and DMARC form a robust defense against email spoofing, phishing, and unauthorized domain use.

Once your SPF setup is in place, think about streamlining the process for more advanced configurations. Managing all three protocols manually can be time-consuming, especially if you oversee multiple domains. Primeforge simplifies this by automating the entire DNS configuration process. It can set up SPF, DKIM, and DMARC according to best practices in about 30 minutes - much faster than the 24+ hours it often takes when using platforms like Google or Microsoft. Plus, Primeforge offers bulk DNS updates, making it easy to adjust SPF records across multiple domains in just a few clicks.

Finally, don’t forget about ongoing maintenance. Keep your SPF record up to date to reflect changes in your email infrastructure. Review your setup quarterly and make updates whenever you add new email services, migrate servers, or retire old systems. Monitor key metrics like delivery rates, bounce rates, and spam complaints to gauge the effectiveness of your authentication setup and spot any issues that need attention.

Your SPF record is the backbone of your email security strategy, but it's only part of the solution. By adding DKIM and DMARC, you can build a complete email authentication framework that offers maximum protection for your domain.

FAQs

Why isn't my SPF record working correctly after setup?

If your SPF record isn’t functioning as expected, the first step is to review its setup carefully. Make sure the record is properly formatted and includes all the domains and IP addresses that are authorized to send emails on your behalf. To catch any errors or conflicts, consider using an SPF record checker tool.

A frequent problem is hitting the SPF lookup limit, which is capped at 10 DNS queries. If this happens, your record might fail. To address this, you can consolidate DNS entries or explore services like Primeforge, which streamline DNS setup and management through automation. Lastly, ensure your DNS updates have fully propagated. This process can sometimes take up to 48 hours, so a little patience might be required.

Should I use a soft fail (~all) or hard fail (-all) in my SPF record, and how do I decide?

When configuring your SPF record, deciding between a soft fail (~all) and a hard fail (-all) comes down to how strict you want your email authentication to be.

  • Soft fail (~all) is a good choice if you're still testing your SPF setup or aren't completely sure you've included all legitimate email sources. With this option, unauthorized emails are flagged as suspicious but might still get delivered.
  • Hard fail (-all) is ideal when you're confident that your SPF record is complete and accurate. This setting tells recipient servers to outright reject unauthorized emails, offering stronger protection against email spoofing.

For those managing multiple domains or mailboxes, tools like Primeforge can make SPF management easier. They provide automated DNS setups and bulk updates, helping to ensure your records are both accurate and efficient.

Can SPF records help improve email deliverability if I use multiple email services and domains?

SPF records play a vital role in improving email deliverability, especially when you're juggling multiple email services or domains. By confirming which servers are authorized to send emails on your behalf, SPF helps keep your messages out of spam folders.

Primeforge makes this process easier by automating SPF setup for Google Workspace and Microsoft 365 mailboxes, ensuring your emails are set up for success.

Related Blog Posts