Suped

How to resolve 'CharacterStringTooLong' error when flattening SPF records?

Summary

The "CharacterStringTooLong" error arises when your Sender Policy Framework (SPF) record, specifically a DNS TXT record, exceeds the maximum allowable length. This often happens after attempting to "flatten" an SPF record, which aims to reduce DNS lookups but can inadvertently create a single, lengthy string that surpasses DNS provider limits, typically 255 characters per string within a TXT record. While SPF flattening is crucial for avoiding the 10-DNS-lookup limit, it's vital to ensure the flattened record also adheres to DNS TXT record size constraints. This issue can significantly impact email deliverability, leading to authentication failures and messages being marked as spam or rejected outright.

Suped DMARC monitor
Free forever, no credit card required
Get started for free
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

What email marketers say

Email marketers often grapple with the practicalities of SPF record management, especially when dealing with multiple sending services. The immediate appeal of SPF flattening tools is clear: reduce DNS lookups to avoid authentication failures. However, the nuance of DNS TXT record limits can turn a solution into a new problem, leading to the dreaded "CharacterStringTooLong" error. Marketers highlight the confusion and frustration when automated tools don't fully address these underlying technical constraints.

Marketer view

Email marketer from Email Geeks notes that SPF flattening for a client on Route 53 resulted in a 'CharacterStringTooLong' error, prompting investigation into potential syntax issues or tool limitations.

29 Oct 2019 - Email Geeks

Marketer view

Email marketer from Email Geeks explains they tried splitting their SPF record across multiple DNS entries (3 or 4) but still encountered the 'CharacterStringTooLong' error, indicating a deeper problem than simple single-record length.

29 Oct 2019 - Email Geeks

What the experts say

Experts in email deliverability emphasize that SPF record issues, particularly length constraints, are common pitfalls. They distinguish between the SPF 10-lookup limit and the fundamental DNS TXT record string length limit, which often causes the "CharacterStringTooLong" error. Their advice centers on understanding the underlying DNS mechanics, careful record construction, and recognizing the limitations of automated flattening tools, especially for long-term reliability and adaptability to changing IP environments.

Expert view

Email expert from Email Geeks clarifies that DNS TXT records are limited to 255 characters. They explain that SPF records that exceed this limit, even if split across subdomains, must be further split into multiple consecutive TXT record strings on the same domain to comply with the standard.

29 Oct 2019 - Email Geeks

Expert view

Email expert from Email Geeks suggests that SPF flattening services often perform DNS lookups but may fail to create appropriately segmented TXT records. They mention never personally relying on a service to automatically handle the entire SPF creation process.

29 Oct 2019 - Email Geeks

What the documentation says

Technical documentation outlines the precise specifications for DNS records, including TXT records used for SPF. The core of the "CharacterStringTooLong" error stems directly from these foundational rules. RFCs and other authoritative sources detail the character limits for individual strings within a TXT record, as well as how multiple strings are to be handled by DNS clients. Understanding these specifications is critical for proper SPF implementation and avoiding common configuration errors, especially when SPF records grow complex.

Technical article

Documentation from RFC 1035, Section 3.3.14, outlines that TXT RRs are designed to hold descriptive text, and the value within these records is a character string which can be up to 255 characters long, directly addressing the limit for each string.

Nov 1987 - RFC 1035

Technical article

Documentation from RFC 7208 (SPF) specifies that the string of an SPF Resource Record (RR) should not be longer than 255 characters, reinforcing the fundamental DNS TXT record string length constraint for SPF implementation.

Apr 2014 - RFC 7208

7 resources

Start improving your email deliverability today

Get started