How to Set Up SPF Records in cPanel: Complete Step-by-Step Guide
Learn how to configure SPF records in cPanel DNS Zone Editor. Includes screenshots, troubleshooting, and best practices for email authentication.
MailSentinel Team
Author
How to Set Up SPF Records in cPanel: Complete Step-by-Step Guide
Setting up SPF (Sender Policy Framework) records is essential for email authentication and deliverability. If you're using cPanel for your hosting and DNS management, this guide will walk you through the entire process.
Why SPF Records Matter
SPF records tell receiving mail servers which IP addresses and servers are authorized to send email for your domain. Without proper SPF configuration:
- Emails may be marked as spam
- Deliverability rates drop significantly
- You fail Google and Yahoo's 2024 requirements
- DMARC won't work properly
Prerequisites
Before you begin, make sure you have:
- cPanel access for your domain
- Admin or reseller access (to modify DNS)
- Your SPF record ready to publish
- List of all services sending email from your domain
Step 1: Access cPanel DNS Zone Editor
- Log in to your cPanel account
- Scroll down to the DOMAINS section
- Click Zone Editor (or Advanced DNS Zone Editor)
- Select your domain from the dropdown menu
You'll now see all your DNS records for the selected domain.
Step 2: Check for Existing SPF Record
Important: Only ONE SPF record is allowed per domain. Multiple SPF records cause validation errors.
Before adding a new record, check if one already exists:
Look for:
- TXT records at the root domain
- Records containing
v=spf1in the value - Records with Name field showing your domain
If an SPF record exists:
- You need to edit it, not create a new one
- Click the Edit button next to the existing record
Step 3: Build Your SPF Record
Common SPF Record Examples
Google Workspace Only:
v=spf1 include:_spf.google.com -allMicrosoft 365 Only:
v=spf1 include:spf.protection.outlook.com -allMultiple Services:
v=spf1 include:_spf.google.com include:sendgrid.net include:servers.mcsv.net -allUnderstanding SPF Components
v=spf1- SPF version (always required)include:- Include another domain's SPF record-all- Fail (reject) all other senders (recommended)~all- SoftFail (accept but mark) - for testing only+all- Pass all - NEVER USE THIS
Step 4: Add SPF Record in cPanel
Option A: Adding New SPF Record
- Scroll down to the Add Record section
- Fill in the fields:
| Field | Value |
|---|---|
| Name | @ or your domain name (e.g., example.com) |
| TTL | 3600 (1 hour) or leave default |
| Type | TXT |
| TXT Data | Your complete SPF record |
Example:
Name: @
TTL: 3600
Type: TXT
TXT Data: v=spf1 include:_spf.google.com -all
- Click Add Record
Option B: Editing Existing SPF Record
- Find your existing SPF TXT record in the records list
- Click Edit next to the record
- Update the TXT Data field with your new SPF record
- Click Save Record
Step 5: Verify Your SPF Record
In cPanel
- Return to Zone Editor
- Verify your SPF record appears in the list
- Check that Name field shows
@or your domain - Verify TXT Data contains your SPF record
Using Online Tools
MXToolbox SPF Checker:
- Go to https://mxtoolbox.com/spf.aspx
- Enter your domain
- Click SPF Record Lookup
- Verify record is detected
MailSentinel:
- Add your domain to MailSentinel
- Run DNS scan
- Verify SPF record is detected
- Check validation status
Common Issues and Solutions
Issue 1: SPF Record Not Detected
Symptoms:
- SPF checkers don't find your record
- MailSentinel shows "No SPF record"
Solutions:
-
Wait for DNS Propagation
- DNS changes can take 15-60 minutes
- Some DNS checkers cache results
- Try multiple DNS checkers
-
Verify Record Location
- Name field should be
@or your domain - Not on a subdomain
- Check exact domain name matches
- Name field should be
-
Check Record Format
- Ensure
v=spf1is present - No extra spaces or line breaks
- Quotes may be added automatically by cPanel
- Ensure
Issue 2: Multiple SPF Records
Symptoms:
- "Multiple SPF records" error
- SPF validation fails
Solutions:
-
Find all SPF records:
- Search for all TXT records with
v=spf1 - Check both root and subdomains
- Search for all TXT records with
-
Merge records:
- Combine all includes into one record
- Keep only one SPF record
-
Delete duplicates:
- Remove extra SPF records
- Keep only the merged record
Issue 3: Too Many DNS Lookups
Symptoms:
- "Too many DNS lookups" error
- SPF validation fails
Solutions:
-
Count Your Lookups:
- Each
include:counts as 1+ lookups - Maximum is 10 lookups total
- Use SPF checker to see breakdown
- Each
-
Reduce Lookups:
- Remove unused includes
- Use subdomains for some services
- Flatten includes to IP ranges (if possible)
Best Practices
1. Start with Monitoring
Begin with ~all (softfail) to monitor:
v=spf1 include:_spf.google.com ~allThen move to -all after verifying all sources:
v=spf1 include:_spf.google.com -all2. Document Your Sources
Keep a list of:
- All sending services
- Their SPF includes
- IP addresses used
- When services were added/removed
3. Regular Audits
Review SPF records quarterly:
- Remove unused services
- Add new services
- Check lookup count
- Verify alignment
4. Test Before Changes
- Use SPF testing tools
- Send test emails
- Check DMARC reports
- Monitor for failures
Next Steps
After setting up SPF in cPanel:
- Configure DKIM - Set up DKIM signing
- Set Up DMARC - Configure DMARC policy
- Monitor SPF - Track validation status
- Set Up Alerts - Get notified of issues
Additional Resources
- Complete SPF Guide - Comprehensive SPF documentation
- cPanel DNS Documentation - Official cPanel guides
- Email Authentication Checklist - Complete setup guide
Need help? Contact MailSentinel Support or check our documentation.