What is an SPF record and how do you set one up?
Published on June 17, 2026 10 min read
What is an SPF record and how does it work? Learn how an SPF record in your DNS stops spoofing and keeps your email out of the spam folder.
An SPF record is a short line in your DNS that defines which mail servers are allowed to send email on behalf of your domain. Receiving servers use that line to check whether a message really comes from you and not from a spammer abusing your domain name. In this article you will learn what an SPF record is, how it works, which SPF record LJPc sets up for you by default, how to adjust it when you also send email through another service, and which mistakes to avoid.
What is an SPF record?
SPF stands for Sender Policy Framework. It is an open standard, defined in RFC 7208, that helps prevent sender forgery (spoofing) and spam. With an SPF record you publish a list of IP addresses and servers in your DNS that are allowed to send email using your domain as the sender.
Technically, an SPF record is a specially formatted TXT record in your DNS zone. One thing is important to know: only one SPF record per domain is allowed. If there are several, the receiver cannot evaluate the check and returns an error (a PermError), and your policy no longer counts.
Why is an SPF record important?
Without sender verification, almost anyone can send email that shows your domain as the sender. That opens the door to phishing and spoofing. An SPF record gives receiving mail servers a reliable way to verify that a message comes from an approved server.
SPF also plays a major role in your email deliverability. Mail servers trust authenticated messages more. If SPF is missing or set up incorrectly, your email ends up in the spam folder more quickly or gets rejected. SPF is therefore a fixed part of solid email security.
The major providers now treat it as a requirement. Since February 2024, Gmail and Yahoo require every sender to have at least SPF or DKIM in place. Anyone sending more than 5,000 messages per day to Gmail must have SPF, DKIM and DMARC all in order. Since May 2025, Microsoft sets the same three requirements for senders that send more than 5,000 messages per day to Outlook.com and Hotmail.
How does an SPF record work?
When a mail server receives a message, it roughly goes through these steps:
- The server reads the envelope sender of the message. That is the Return-Path (also called MAIL FROM), not necessarily the visible From address you see in your mail program.
- It looks up the SPF record in the DNS of that sender domain.
- It compares the IP address of the sending server with the list in the SPF record.
- Based on that, it returns a result, for example pass (allowed) or fail (not allowed).
Because SPF looks at the envelope sender and not at the visible From address, a sender can sometimes still forge that visible address. That is why you combine SPF with DKIM and DMARC, which do take the visible sender address into account.
What does an SPF record look like?
An SPF record is a single line of text that always begins with the version tag v=spf1, followed by one or more parts (mechanisms) and a closing all rule. This is the record LJPc places on your domain by default when you have a hosting package with us:
v=spf1 include:_spf.ljpc.network -all
The part include:_spf.ljpc.network points to the list of LJPc's outgoing mail servers. That list consists of IP addresses only, so it uses one of the ten DNS lookups an SPF record is allowed (see the common mistakes below). The closing -all means that other servers may not send email on behalf of your domain.
A general example with your own server and an external service:
v=spf1 ip4:192.0.2.0/24 include:_spf.example.com ~all
If you only use Google Workspace for your email, for instance, the line often looks like this:
v=spf1 include:_spf.google.com ~all
Common mechanisms
Each mechanism describes a group of servers that is allowed to send. The most common ones are:
| Mechanism | Meaning |
|---|---|
ip4 / ip6 | A specific IP address or range that is allowed to send. |
a | The IP addresses from the domain's A and AAAA records. |
mx | The servers from the domain's MX records. |
include | Points to the SPF policy of another party, for example your hosting provider or Google. |
all | Closes the record and decides what happens to senders that are not in the list. |
The all rule: -all or ~all
For the all mechanism you add a qualifier that sets how strict you are:
-all(hardfail): anything not in your list fails hard and can be rejected.~all(softfail): such messages are marked as suspicious, but usually not rejected.?all(neutral): no judgement.+allallows everyone and should never be used.
LJPc sets -all by default. If you add a new sender and are not yet sure your list is complete, you can use ~all for a while. Switch back to -all as soon as you are sure all senders are included.
SPF at LJPc: already set up by default
If you have a hosting package at LJPc and your domain uses our name servers, your domain already has an SPF record: v=spf1 include:_spf.ljpc.network -all. It allows all email you send through LJPc, from your mailboxes and from your website, to leave on behalf of your domain. You do not need to set anything up yourself. We also set up DKIM and DMARC for you by default; which values are in place is explained in our explanation of DMARC.
The include:_spf.ljpc.network entry tells receiving servers that our outgoing mail servers may send email for your domain. Put that entry directly in your domain's SPF record, not through another service's include. If you remove it, or replace the record with one from another service, recipients may reject your email or put it in spam.
Do you also send email through another service, such as Microsoft 365, a newsletter service or your accounting software? Then edit the existing record instead of creating a second one. Add the new sender to the same record, before the closing part, and keep include:_spf.ljpc.network in place. With Microsoft 365 added, the record looks like this:
v=spf1 include:_spf.ljpc.network include:spf.protection.outlook.com -all
Which entry a service needs is described in that service's documentation. Adding all of a service's records without breaking your email is covered in how to add DNS records from an email or marketing service. Services often also ask you to set up DKIM for your domain. How DKIM works is explained in our explanation of DKIM.
Where you find the SPF record depends on your package:
- Hosting package: you manage the DNS in Plesk, under the DNS Settings of your domain. From the customer portal, you open Plesk without logging in separately; how that works is explained in open Plesk from the customer portal.
- DNS management only at LJPc: you manage the records in the customer portal. Open the Domains page in the Services menu and click your domain. There is not always an SPF record in place. If you see no TXT record on your main domain under DNS records that starts with
v=spf1, create one with the senders that send email for your domain. - DNS with another provider: then your SPF record belongs there. If you send email through LJPc, include
include:_spf.ljpc.networkin it.
How to view, add and change records in Plesk and in the portal is explained step by step in managing DNS records.
Setting up or changing an SPF record
This is how you set up or change an SPF record:
- Map out which services send email on behalf of your domain: your mail server and hosting provider, but also a newsletter tool, web shop or CRM system.
- Check whether your domain already has an SPF record: a TXT record on your main domain that starts with
v=spf1. With a hosting package at LJPc, it does. - Build a single line that starts with
v=spf1and covers all those senders, usually withincludefor external services andip4for your own servers. If you send email through LJPc, keepinclude:_spf.ljpc.networkin it. - Close it with
-all, or temporarily with~allwhile you are still testing. - If there already is an SPF record, edit that record. Do not delete it and create it again: that way your domain keeps a valid SPF record during the change as well. If there is none yet, create a single TXT record at the root of your domain (
@). Enter the value without quotes around it. - Save the record. At LJPc, a change usually reaches our name servers within a minute. Servers that still have the old value in their cache only see the new one once the TTL expires, which at LJPc is usually after an hour. Read more in DNS propagation.
Then test with a sample message to another mailbox, or with an online SPF checker, and confirm that the result is pass. You can also see what is on your domain with dig TXT yourdomain.com +short (macOS and Linux) or nslookup -type=TXT yourdomain.com (Windows). Read more about these commands in troubleshoot DNS problems.
Common mistakes
A few mistakes come up often. This table helps you recognize and fix them:
| Problem | Cause | Solution |
|---|---|---|
| PermError | Multiple SPF records on the same domain. | Merge everything into one SPF record. At LJPc there already is one: add the new sender to it. |
| Too many DNS lookups | More than ten DNS lookups in your record. | Reduce the number of include, a and mx parts. |
| Legitimate mail fails | A sender is missing from the list. | Add the missing server or service. |
| Email sent through LJPc is rejected or ends up in spam | include:_spf.ljpc.network is missing from your domain's SPF record. | Put it back in the existing record. |
| Spoofing still possible | SPF only, without DKIM and DMARC. | Set up DKIM and DMARC as well. With a hosting package at LJPc, they are already in place. |
Pay particular attention to the limit of ten DNS lookups. The parts include, a, mx, ptr, exists and the redirect modifier all count toward it, including the lookups inside an include. If you go over ten, the check returns a PermError. The ptr mechanism is also discouraged because it is slow and unreliable.
SPF, DKIM and DMARC together
SPF is one of the three pillars of modern email security, but it is not a complete solution on its own. An important limitation is that SPF can fail with forwarded email: an intermediate server then sends your message from an IP address that is not in your SPF record.
That is why you complement SPF with DKIM and DMARC. DKIM adds a digital signature to your messages that survives forwarding. DMARC ties SPF and DKIM to the visible sender address and tells receivers what to do with failed checks. Many receivers also look at a correct PTR record (reverse DNS) for the sending IP address. This is separate from the ptr mechanism mentioned earlier and is in fact recommended.
With a correct SPF record you take an important first step toward reliable email and less spoofing. Combine it with DKIM and DMARC for the best protection. If your email does not arrive or ends up in spam, see fix email problems. Still stuck? Create a support ticket and we will look into it with you.
Frequently asked questions
Is an SPF record mandatory?
It is not a legal requirement, but in practice it is almost indispensable. Since February 2024, Gmail and Yahoo require senders to have at least SPF or DKIM in place. Anyone sending more than 5,000 messages per day needs SPF, DKIM and DMARC at Gmail, and since May 2025 at Microsoft as well. Without SPF, your email ends up in spam more quickly or gets rejected. At LJPc, the SPF record is also needed to send email through our mail server.
Do I need to create an SPF record myself at LJPc?
No. With a hosting package at LJPc that uses our name servers, there already is an SPF record: v=spf1 include:_spf.ljpc.network -all. If you also send email through another service, add it to this existing record and keep include:_spf.ljpc.network in place. If you only have DNS management with us, check in the customer portal whether an SPF record is already in place.
Can I have multiple SPF records?
No. Only one SPF record per domain is allowed. If you have several senders, merge them into one line with multiple include and ip4 parts. Multiple separate SPF records lead to a PermError, which makes the check fail. At LJPc there already is an SPF record; add new senders to it.
What do ~all and -all mean?
The all rule decides what happens to senders that are not in your list. With ~all (softfail), such messages are marked as suspicious but usually still delivered. With -all (hardfail), the check fails and the receiver can reject them. LJPc uses -all by default. If you add a new sender, you can use ~all for a while until you are sure your list is complete.
What is the difference between SPF, DKIM and DMARC?
SPF defines which servers may send on behalf of your domain. DKIM adds a digital signature to your messages. DMARC ties both to the visible sender address and tells receivers what to do with failed checks. Together they form the basis of modern email security.
Why does SPF sometimes fail for forwarded email?
SPF checks the IP address of the sending server against the envelope sender. When a message is forwarded, an intermediate server sends it on, and that IP address is usually not in your SPF record. As a result, SPF can fail. DKIM and DMARC partly make up for this.
How do I check whether my SPF record is correct?
Send a sample message to another mailbox and look at the SPF result (pass or fail) in the message headers, or use an online SPF checker. If you see a PermError, that often points to multiple records or too many DNS lookups.