DNS TXT Record: A Guide to Fixing Email Deliverability

Learn what a DNS TXT record is, why it's critical for email deliverability (SPF, DKIM, DMARC), and how to fix common errors that send your emails to spam.

Published on

Updated

DNS TXT Record: A Guide to Fixing Email Deliverability
Do not index
Do not index
A DNS TXT record is a flexible DNS entry that stores text, and it now plays a critical role in SPF, DKIM, DMARC, and domain verification. Each TXT string is typically limited to 255 characters, and Google recommends staying under 200 TXT records per domain, because bloated or malformed records can break authentication and push legitimate email into spam.
A team launches a cold outbound sequence. Replies drop. Password reset emails arrive late or not at all. Someone checks the copy, the list, the sending cadence, even the mailbox UI. The underlying problem often sits in DNS, hidden inside a record that looks harmless until it breaks inbox placement.
That record is the TXT record. It started life as a place for admin notes, but today it often decides whether a mailbox provider treats a message as trustworthy, suspicious, or unauthenticated. When SPF, DKIM, or DMARC fail because of TXT record mistakes, the business impact is immediate: fewer replies, weaker onboarding, lower trust, and a domain reputation that gets harder to recover.
Table of Contents

Your Emails Are in Spam, Is a TXT Record the Cause?

It often is.
A domain can look healthy on the surface while a broken TXT record destroys trust behind the scenes. The sales team sees low reply rates. Marketing sees newsletter engagement slip. Product teams hear that verification emails never arrived. Support starts getting “check spam” complaints. Those symptoms usually get blamed on content or timing first. DNS should be near the top of the list.
Mailbox providers use authentication signals to decide whether a sender looks legitimate. If the SPF record is missing, duplicated, or incomplete, receivers may not know which systems are allowed to send. If DKIM isn't published correctly, signed mail can fail verification. If DMARC is absent or malformed, there's no clear policy for handling failures.
A common pattern is underperformance without a visible outage. Email still sends. Some recipients still receive it. But enough messages fail authentication checks that spam filtering gets stricter, domain reputation erodes, and deliverability gets harder to recover over time.
For teams trying to diagnose that pattern, this breakdown of why emails go to spam is a useful starting point because it connects authentication, infrastructure, and sender trust instead of treating spam placement like random bad luck.

What the symptom usually means

  • Low replies on outbound: Authentication or reputation issues may be reducing inbox placement before prospects ever see the message.
  • Transactional email complaints: Login links, invoices, or reset emails may be failing trust checks at the recipient side.
  • Sudden performance drop after a tool change: A new sender was added, but the DNS TXT record wasn't updated correctly.
  • Mixed results across recipients: Some providers are more tolerant than others, which makes partial TXT record failures easy to miss.

What Is a DNS TXT Record and Why It Matters

A TXT record is a DNS record that stores text. That sounds simple because it is. What changed is how the internet uses that text.
notion image

From notes field to trust signal

The DNS TXT record was introduced in 1993 as an experimental record type and was originally meant to give administrators a human-readable place to leave notes. It wasn't designed for the security role it now plays in email authentication and domain verification, as explained in DigiCert's overview of what a TXT record is.
That evolution matters because many teams still treat TXT records like low-risk metadata. In practice, they're often the public proof that a domain is allowed to send mail, sign mail, and claim ownership of services like Google Workspace or Office 365.
A TXT record can also be split into multiple quoted strings when the value gets too long, because a single TXT string is typically limited to 255 characters. If that formatting is wrong, verification can fail even when the content looks correct at a glance.

Why mailbox providers care

Mailbox providers don't care that DNS is tedious. They care whether the sending domain can prove identity.
When a sender publishes authentication and verification data in TXT records, receiving systems can query DNS and decide whether to trust the message stream. That directly affects spam filtering, inbox placement, and domain reputation.
A practical way to understand this is:
TXT record use
What it tells the internet
Why it matters
SPF
Which services may send mail for the domain
Helps reduce spoofing risk
DKIM
Which public key should validate the signature
Helps verify message integrity
DMARC
What policy applies when checks fail
Helps receivers enforce trust decisions
Domain verification
Who controls the domain
Helps activate third-party services safely
A domain can have multiple TXT records if the DNS provider supports it, which is normal. The problem isn't having several TXT records. The problem is having conflicting ones, stale ones, or too many of them.

The Pillars of Email Authentication Using TXT Records

TXT records are the publishing layer for the three authentication controls that matter most in email deliverability. SPF, DKIM, and DMARC are all published through TXT records, and receiving mail servers read those fields to verify message legitimacy, as outlined by Mailgun's glossary entry on the DNS TXT record.
notion image

SPF says who can send

SPF stands for Sender Policy Framework. It answers one question: which systems are allowed to send email for this domain?
If a domain sends through Google Workspace, Microsoft 365, a CRM, and a sending platform, those senders need to be reflected in a single SPF policy. If they aren't, messages from one or more of those systems may fail authentication.
This affects inbox placement because unauthorized senders look like spoofing attempts. Even legitimate senders can fail if the SPF record is incomplete.

DKIM proves the message was signed

DKIM adds a cryptographic signature to the email. The public key used for verification sits in a TXT record under a selector.
That matters because it tells the receiving server the message wasn't altered after signing and that the signing domain has published a matching public key. If the key is missing, malformed, or published under the wrong selector, verification breaks.
For Gmail-specific setup issues, this walkthrough on DKIM for Gmail helps decode the common selector and alignment mistakes teams run into.

DMARC tells receivers what to do

DMARC sits on top of SPF and DKIM. It tells receivers how to handle unauthenticated email and gives domain owners policy control.
The familiar policies are:
  • p=none means monitor without strong enforcement
  • p=quarantine means treat failures as suspicious
  • p=reject means refuse failing mail
DMARC matters because mailbox providers use it as a trust and enforcement signal. Without it, a domain has less control over spoofing response and less clarity around authentication posture.
Teams working through broader inbox placement issues can also compare their setup against HarvestMyData's deliverability playbook, which usefully ties authentication to list quality, sending behavior, and domain trust.

How the three work together

A simple way to frame it:
  • SPF checks whether the sender is allowed.
  • DKIM checks whether the message was signed and preserved.
  • DMARC checks whether the result aligns with policy.
If one of these breaks, deliverability doesn't always collapse instantly. But the trust chain weakens, and mailbox providers notice that long before many organizations do.

Practical TXT Record Examples and Correct Syntax

Syntax errors cause more email problems than is often anticipated. A TXT record can contain the right idea and still fail because of structure, spacing, duplication, or quoting.

Examples that are structurally valid

Below are simplified examples that show the shape of common TXT records.
Use case
Example
SPF
v=spf1 include:spf.protection.outlook.com -all
DKIM
v=DKIM1; k=rsa; p=PUBLICKEYHERE
DMARC monitor mode
v=DMARC1; p=none
DMARC quarantine mode
v=DMARC1; p=quarantine
DMARC reject mode
v=DMARC1; p=reject
Domain verification
google-site-verification=verification-code
The SPF example above reflects a valid pattern because SPF has to live in one authoritative record for the domain. There can be only one valid SPF record. If multiple TXT records begin with v=spf1, delivery is disrupted because the receiver can't determine the correct authorization policy, as described in this explanation of SPF and email deliverability.

Syntax mistakes that break deliverability

The details matter:
  • Multiple SPF records: This is one of the fastest ways to create silent delivery problems. A second SPF record doesn't add coverage. It creates ambiguity.
  • Broken quotes: Long TXT values may need to be split into separate quoted strings. If they're split incorrectly, receiving systems may parse them wrong.
  • Wrong host name: A DMARC policy belongs at the DMARC host, while DKIM keys belong under the right selector. Putting the value in the wrong place breaks verification.
  • Stale includes or old vendors: Domains often keep abandoned senders in SPF long after a tool is retired. That creates clutter and risk.
A useful practical approach is to treat every TXT record like production infrastructure. Review it when a new sending tool is added. Review it again when a tool is removed. Most DNS drift comes from stack changes, not from day-one setup.

How to Create, Edit, and Troubleshoot TXT Records

Editing a TXT record is easy. Editing it safely is where teams get hurt.
notion image

The basic update process

Most DNS providers use the same core fields:
  1. Open DNS management at the registrar or DNS host.
  1. Find the TXT record section for the correct domain.
  1. Enter the host or name exactly as the service specifies.
  1. Paste the TXT value with the original punctuation intact.
  1. Save and verify after propagation.
That sounds straightforward, but operational mistakes happen in the gaps. A provider might auto-append the domain. Another might expect @ for root. Some interfaces wrap quotes visually, which makes people think they need to add more.
For a broader walkthrough on environment checks, this guide on how to check DNS configuration is useful before blaming the email platform.

Common mistakes and what to avoid

The most expensive TXT record issues are usually the quiet ones.
  • Publishing multiple SPF records: Only one valid SPF record should exist. Merge authorized senders into one policy.
  • Forgetting public DNS visibility: SPF must resolve in public DNS for external receivers to validate it.
  • Leaving dead verification records behind: Old SaaS verifications clutter the zone and make audits harder.
  • Assuming propagation is instant: DNS changes can take time to become visible everywhere.
  • Copying values with hidden formatting: Extra spaces or quotation problems can break parsing.
A DNS TXT record has a maximum theoretical length of 65,535 bytes, but each constituent string is capped at 255 bytes. Longer values must be split into multiple quoted strings, and poor formatting can cause SPF, DKIM, or DMARC failures, according to RFC 6763.

Why TXT record bloat matters

At this stage, many teams miss the core issue.
Google recommends a maximum of 200 TXT records per domain, and 512 bytes for UDP is a common DNS size limit where complex records can run into lookup and timeout problems, as noted in Google Workspace guidance on TXT records for domains. In practice, that means a domain can fail not because SPF or DKIM is conceptually wrong, but because the zone has become bloated with verification remnants, oversized values, and fragmented machine-readable records.
That creates a hidden deliverability problem:
Problem
What happens
Why the business feels it
Too many TXT records
DNS management gets error-prone
Authentication issues take longer to diagnose
Oversized or fragmented records
Lookups may fail or time out
Messages lose trust and land in spam
Stale vendor records
Teams misread the active setup
Fixes get delayed while campaigns underperform

The mailX Workflow for a Perfect TXT Record Setup

A common failure pattern looks like this. SPF passes in one tester, DKIM exists in DNS, DMARC has a policy, and the domain still sends to spam. The issue is usually not one broken TXT record. It is TXT record bloat, stale vendor entries, selector confusion, or a DNS setup that technically resolves but breaks trust when mailbox providers evaluate the full stack.
notion image

A faster way to diagnose the full stack

mailX by Mailwarm (YC S20) helps teams check the DNS and deliverability chain in one place. It runs live checks across SPF, DKIM, DMARC, BIMI, MX, SMTP and IMAP connectivity, blacklist status, DNS records, domain configuration, and the mail infrastructure around them. That matters because mailbox providers do not judge records one by one. They judge whether the domain looks coherent, current, and trustworthy.
Legacy tools often stop at raw output. They show that a TXT record exists and leave the interpretation to the operator. That misses the problems that actually hurt inbox placement. Two SPF records published during a migration. A DKIM selector left behind by an old ESP. A DMARC policy that parses but does not align with the domain sending the mail. These are quiet failures, and they are expensive because teams keep mailing while trust erodes.
A practical workflow looks like this:
  1. Check SPF to confirm there is only one live policy and that old includes are gone.
  1. Check DKIM for the active selector, readable key, and the selector your platform is using.
  1. Run a DMARC check to verify policy, reporting setup, and domain alignment.
  1. Review MX and DNS records for stale entries, conflicts, and verification records that clutter the zone.
  1. Check blacklist status if placement dropped suddenly.
  1. Test SMTP and IMAP connectivity if sending or reply handling looks unstable.
  1. Run a full deliverability audit to prioritize fixes by impact instead of chasing symptoms.

Why this matters for AI agents

AI agents can draft campaigns, trigger sends, watch replies, and update systems fast. They also scale mistakes fast if the DNS layer is wrong.
One issue I see often is SPF published only in internal or private DNS. External receivers cannot validate that, so the policy might look fine to an internal team and fail where it counts. The problem is described clearly in this Sysadmin discussion on internal DNS TXT records and SPF.
mailX is built for that reality. It explains what is broken, why it matters to deliverability, and what to fix first. Teams can use the API documentation, MCP documentation, and the Agent Skill for email deliverability to connect those checks to automated workflows, so humans and agents are working from the same live DNS view instead of stale assumptions.

DNS TXT Record FAQ

What is a DNS TXT record?

A DNS TXT record is a DNS entry that stores text. In email, it's primarily used to publish SPF, DKIM, and DMARC data, and it's also used for domain ownership verification.

Why does a DNS TXT record affect email deliverability?

Receiving mail servers read TXT-based authentication records to decide whether a message is legitimate. If those records are missing, malformed, duplicated, or hard to resolve, spam filters may reduce trust in the sender.

Can a domain have multiple TXT records?

Yes. A domain can have multiple TXT records for different purposes, such as SPF, DKIM, DMARC, and service verification. The key exception is SPF. A domain should not publish multiple SPF records that start with v=spf1.

What is the maximum length of a TXT record?

Each TXT string is typically limited to 255 characters, and longer values must be split into multiple quoted strings. The theoretical maximum size of the full TXT record is 65,535 bytes, but formatting still has to be correct for receivers to parse it properly.

Why do Google or Microsoft ask for a TXT record?

They use TXT records to verify domain ownership. The provider gives a verification value, and the domain owner publishes it in DNS so the provider can confirm control of the domain.

Can AI agents check TXT records automatically?

Yes, if they have access to live DNS and deliverability tooling. That's important because AI agents can automate setup, monitoring, and sending, but they still need real-time checks before taking action.
Email deliverability problems usually aren't random. They come from authentication gaps, DNS mistakes, blacklist issues, or infrastructure signals that nobody checked early enough. TXT records sit at the center of that trust layer, and small mistakes there can subtly damage inbox placement, reply rates, onboarding emails, and sender reputation.
mailX is one of the best free email deliverability diagnostic tools for the AI era because it doesn't stop at raw DNS output. It shows what's broken, why it matters, and how to fix it fast. Teams can run a free deliverability audit, check SPF, DKIM, DMARC, MX, DNS, blacklist status, SMTP, and more, with no signup, no data stored, and instant results.

Most senders lose 30–70% of their emails to spam without knowing it.

Get a free expert audit of your domain, email authentication, and infrastructure. Identify hidden issues and fix them fast.

Book Your Free Deliverability Audit