Last updated: · By Asael Dreyer
Short answer: SPF, DKIM and DMARC are three TXT records in your domain’s DNS that prove to mail servers that an email sent in your name really comes from you. SPF lists which services are allowed to send for your domain, DKIM adds a digital signature to every email, and DMARC tells the receiving server what to do with an email that fails the checks. For a site on Cloudways you copy the values from your sending service (Elastic Email, Mailgun, SendGrid and so on), add them at your registrar or in Cloudflare, and make sure the domain has only one SPF record.
⏱ Time: 15–30 minutes, plus up to 24 hours for DNS to update · Difficulty: medium · Last checked against the official documentation: 6 Nov 2026
What SPF, DKIM and DMARC are, in plain language
Anyone can send an email with info@your-business.com in the “From” field. To tell a real email from a fake one, mail servers like Gmail and Outlook check three things in your domain’s DNS.
SPF (Sender Policy Framework) is a guest list. It is a single TXT record on the domain, starting with v=spf1, listing which servers and services are allowed to send email for the domain. An email that arrives from a server that isn’t on the list is treated as suspect.
DKIM (DomainKeys Identified Mail) is a seal. The sending service signs every email with a cryptographic signature, and publishes the public key in DNS that lets others verify it. If the signature is valid, the receiving server knows the email was sent with the domain owner’s approval and wasn’t altered along the way.
DMARC is a policy. It tells the receiving server: “if an email in my name fails SPF and DKIM, handle it like this”: do nothing, send it to spam, or reject it. It can also ask for reports about who is sending in your name.
| Record | Where it lives | Example | What happens without it |
|---|---|---|---|
| SPF | TXT at the domain root (@) | v=spf1 include:_spf.elasticemail.com ~all | The receiving server doesn’t know who is allowed to send |
| DKIM | TXT (or CNAME) on a subname like api._domainkey | v=DKIM1; k=rsa; p=... | No proof the email wasn’t forged |
| DMARC | TXT named _dmarc | v=DMARC1; p=none; | No policy and no reports, and bulk senders to Gmail may be rejected |
Why this is urgent now: since 1 Feb 2024 Google requires everyone sending to Gmail to have at least SPF or DKIM, and anyone sending more than 5,000 emails a day to Gmail to have all three, including DMARC (a p=none policy is enough). An unauthenticated email may land in spam or be rejected.
Before you start
- A list of every service that sends email in your domain’s name: your site’s sending service, mailboxes (Rackspace, Google Workspace, Microsoft 365), a newsletter system, a CRM, an invoicing system. Each of them has to be included in SPF.
- A sending service connected to the server. If you haven’t chosen one yet, see which email solution to choose. For example, Elastic Email through Cloudways starts at $0.10 per month for 1,000 emails (up to $57 for 1,000,000), as of 6 Nov 2026 according to the product page.
How do you set up an SPF record?
Adding a new SPF record
- First check whether the domain already has a TXT record starting with
v=spf1. If it does, don’t add a new one. Go to the merging section. - In DNS management create a new record of type TXT.
- In Name/Host enter
@. In some registrar interfaces you leave the field empty or write the full domain, depending on what the interface asks for. - In Value enter the value your service gives you. For example, for Mailgun:
v=spf1 include:mailgun.org ~all. - In TTL leave Automatic or the lowest value, and save.
The common includes
| Service | What to add to SPF |
|---|---|
| Elastic Email (Cloudways) | include:_spf.elasticemail.com (in the Cloudways documentation the full value is v=spf1 a mx include:_spf.elasticemail.com ~all) |
| Rackspace Email (Cloudways) | include:emailsrvr.com |
| Mailgun | include:mailgun.org |
| Google Workspace | include:_spf.google.com |
| Other services | The value shown in their domain verification settings |
Merging two SPF records into one
This is a common mistake: every service you add asks you to “add an SPF record”, and someone adds it as another record. A domain is allowed only one SPF record. If there are two, both are invalid, and all your emails fail SPF.
Say you have Elastic Email for site emails and Rackspace for team mailboxes:
v=spf1 a mx include:_spf.elasticemail.com ~all
v=spf1 include:emailsrvr.com ~all
The merging rules:
v=spf1once, at the start.aandmx, if they appeared in either record, only once.- All the
includeentries from all the records, one after another. - Only one
all, at the end. Choose the option that suits you (explained in the table below).
The result:
v=spf1 a mx include:_spf.elasticemail.com include:emailsrvr.com ~all
Delete the two old records and keep only the merged one. Merging SPF doesn’t change your MX records and doesn’t affect receiving email, only the approval to send.
What ~all, -all and ?all mean
| Ending | Name | What the receiving server does with a sender that isn’t on the list |
|---|---|---|
-all | Fail | Rejects it or marks it as a clear failure |
~all | Soft fail | Accepts it, but marks it as suspicious |
?all | Neutral | Takes no position on the record |
+all | Pass | Approves everyone. Never use this |
My recommendation (my own call, and the examples in the Cloudways documentation use both ~all and -all): start with ~all. After a few weeks, once you are sure every service that sends in your name is in the record, you can move to -all. Also, according to the documentation, don’t add + before an include. It’s redundant and can fail checks at some servers.
The 10-lookup limit
An SPF record can cause at most 10 DNS lookups. The mechanisms include, a, mx, ptr, exists and redirect are counted, and every include can contain its own includes. Beyond 10, SPF fails.
If you hit the limit: remove includes for services you no longer use, remove a and mx if those servers don’t actually send email, or have a particular service send from a subdomain (for example news.your-business.com), which has its own separate SPF record.
Setting up DKIM
A DKIM record is unique to each service and each domain, so you always copy it from the service. You can’t “guess” it.
- In your sending service, open the domain verification page. In Mailgun, for example: Domains, pick the domain, then the Sending section.
- Copy the record’s name (Host) and its value.
- In DNS management create a TXT record. In Name/Host enter the name exactly as it appears at the service, for example
pic._domainkeyorapi._domainkey. - In Value paste the whole value, which usually starts with
v=DKIM1; k=rsa; p=, without line breaks and without extra spaces. - Save, and go back to the service to click Verify.
Keep three things in mind:
- Registrars that append the domain themselves: if you enter
api._domainkey.domain.comin an interface that adds the domain automatically, you getapi._domainkey.domain.com.domain.com. Check how your interface displays existing records. - Different services, different records: unlike SPF, every service has its own DKIM record, under a different name, and that’s fine. But when you leave a service, delete its old DKIM, and don’t mix values between services.
- Elastic Email: the Host name is
api._domainkey. Since October 2026, new domains are verified with a 2048-bit key (domains already verified with the old key keep working). If your DNS provider rejects the value because it is too long, you split it into two quoted strings, and most providers do this automatically. - CNAME instead of TXT: some services, like SendGrid, give you CNAME records for domain verification instead of TXT. Add exactly the record type the service asks for. In Cloudflare, leave such records as DNS only (grey cloud).
Cloudways has a dedicated guide for Elastic Email’s records, including DKIM and Tracking: verifying a domain in Elastic Email. For Rackspace, Cloudways support can help with DKIM setup. For a comparison of Google Workspace, Microsoft 365 and Rackspace see business email on your own domain.
How do you set up a DMARC record?
DMARC builds on SPF and DKIM, so you set it up last, after both are working.
- In DNS management create a TXT record.
- In Name/Host enter
_dmarc. - In Value start with a monitoring-only policy:
v=DMARC1; p=none; rua=mailto:dmarc@domain.com
- Save. The mailbox in
ruawill start receiving daily reports from the big mail servers, in XML format. It’s better to point them to a dedicated mailbox or to a service that analyzes DMARC reports.
The syntax according to RFC 7489 (checked 6 Nov 2026): the v=DMARC1 tag must be first in the record, and tags are separated by semicolons. If the rua mailbox is on a different domain, the receiving domain needs to publish an authorization record. Elastic Email’s documentation offers both a version without reports (v=DMARC1; p=none;) and a version with rua and ruf. The policy applies to all email sent from the domain, not only Elastic Email’s.
| Stage | p value | Meaning | When |
|---|---|---|---|
| 1. Monitoring | p=none | Change nothing, just collect reports | From the start, for at least a few weeks |
| 2. Quarantine | p=quarantine | An email that fails goes to spam | When the reports show all your legitimate senders pass |
| 3. Reject | p=reject | An email that fails is rejected outright | Full protection against domain spoofing |
Don’t jump straight to p=reject. If you forgot a service (say, the invoicing system that sends in your name), all its emails will vanish without anyone knowing.
Why DMARC fails even when SPF passes
DMARC also checks alignment: the domain in the “From” field the recipient sees has to match the domain that passed SPF or DKIM. If your site sends as info@your-business.com, but the sending service signs with its own domain and not yours, SPF can pass and DMARC will still fail. That’s why it matters to verify your domain with the sending service, and to send only from an address on that domain.
How to check that everything works
- Wait for propagation. DNS changes sometimes take up to 24 hours. If verification fails right after you add a record, wait a few hours before you change anything.
- Send a test email to a tool like mail-tester, which shows a score and a breakdown of SPF, DKIM and DMARC.
- Check a real email in Gmail: open an email sent from the site, choose “Show original” from the three-dots menu, and look for
SPF: PASS,DKIM: PASSandDMARC: PASS. - Make sure there is only one SPF record starting with
v=spf1, with a singleallat the end.
The code BFCM802 takes 80% off your bill for the first two months (up to $200 off per month), including unlimited free site migrations. New customers only, and only until the offer ends.
The offer ends on December 4, 2026 at 23:59 (UTC+2).
Start with a free trial, no credit card. Enter the code at checkout and check that it shows up.
After Black Friday: 30% off for 3 months with the code ASAEL. On a large server (above about $444 a month) ASAEL already saves more today. BFCM802 vs. ASAEL calculator
Start a free trial server, no credit card. When you move to a paid plan, the code ASAEL takes 30% off your bill for the first three months.
The link fills in the code on the signup form. Just make sure it shows up.
Common mistakes and how to fix them
Two SPF records: the most common of all. Merge them into one using the rules above.
DKIM isn’t verified: the name (Host) isn’t exactly what the service asked for, the value was pasted with spaces or line breaks, or the interface added the domain twice. Check the record with a DNS lookup tool.
Emails are still in spam even though everything is PASS: authentication is necessary, not sufficient. Check the sender address (on your own domain, not gmail.com), the content (shortened links, marketing words, an image with no text), and the complaint rate. Google requires the reported spam rate to stay below 0.30% (and recommends below 0.10%).
You moved to Cloudflare and emails broke: the TXT and MX records weren’t copied, or a CNAME record for an email service was switched to Proxied (orange cloud). Copy everything, and leave email records as DNS only.
You switched sending service: remove the old service’s include and DKIM. Unneeded records waste DNS lookups and can cause confusion.
You hit more than 10 lookups: remove services you don’t use, or move sending to a subdomain.
Sources
- Cloudways Knowledge Base: Configure your domain with Mailgun SPF and DKIM records
- Cloudways Knowledge Base: How to merge multiple SPF records
- Google: Email sender guidelines
Frequently asked questions
SPF lists which servers are allowed to send for the domain. DKIM adds a signature to every email that proves it was sent with your approval and wasn’t altered along the way. You need both, and DMARC ties them together into one policy.
No. A second record invalidates both, and all emails will fail the SPF check. You merge all the includes into one record, with a single all at the end.
According to Google, anyone sending more than 5,000 emails a day to Gmail accounts has needed DMARC since February 2024, and a p=none policy is enough. Even a small site should set it up, because it protects against domain spoofing and gives you reports.
Usually minutes to a few hours, and sometimes up to 24 hours. If verification fails right away, wait before you change the records.
No. SPF only determines who is allowed to send in your name. Receiving email is determined by MX records, and merging or changing SPF doesn’t touch them.
Wherever the domain’s DNS is managed: at your registrar, or in Cloudflare if you moved your DNS there. If you aren’t sure, check where the domain’s nameservers (NS) point.
Related guides
- Verifying a domain in Elastic Email
- How to set up the WP Mail SMTP plugin
- Which email solution to choose on Cloudways
- How to set up SMTP on Cloudways
- All guides on this topic: Email and message delivery
- The full picture: Cloudways hosting review
Official source: Configure Your Domain with Mailgun SPF and DKIM Records, How to Merge Multiple SPF Records (Cloudways Knowledge Base), Email sender guidelines (Google, checked 6 Nov 2026). Written and checked by Asael Dreyer · Updated: 6 Nov 2026
Disclosure: this is an independent site, not the official Cloudways site. Some links on this site are affiliate links: if you sign up through them we earn a commission, at no extra cost to you. Full details