eggshellscommunity.jpg

#2921: Can a TXT or SPF record be longer than 255 characters?

Cause

SPF record does not support more than 255 characters in a single string. So if we attempt create an SPF record with more than 255 characters in single string, NIOS will return an error "Invalid text string".

 

Resolution

Following are two workarounds with examples.

  1. Using double quoted (" ") strings in an SPF record to split the long string to multiple short strings.

Example :

Let's say the SPF string you are not able to update is : (Using some random IP addresses in the example)

@ IN TXT "v=spf1 ip4:244.11.23.13 ip4:144.21.23.13 ip4:222.11.11.13 ip4:244.182.23.191 ip4:203.101.22.13 a mx ?all"

This can be modified by splitting the string in to two, each string less than 255 characters like this :

@ IN TXT "v=spf1 ip4:244.11.23.13 ip4:144.21.23.13" " ip4:222.11.11.13 ip4:244.182.23.191" " ip4:203.101.22.13 a mx ?all"

The reading application omits the double quotes and concatenates all of the string into one record.

  1. Create multiple sub SPF records and concatenate them into one string using the "Include" statement.

If the actual long SPF record is the same as the above example, we can split the record to two SPF records as shown below:

@ IN TXT _spf1 IN TXT "v=spf1 ip4:244.11.23.13 ip4:144.21.23.13 a mx ?all"

@ IN TXT _spf2 IN TXT "v=spf1 ip4:222.11.11.13 ip4:244.182.23.191 ip4:203.101.22.13 a mx ?all"

Then create a third SPF record with the include statement as below to concatenate both the SPF records in to one.

@ IN TXT "v=spf1 include:_spf1.myhost.com include:_spf2.myhost.com a mx ?all"

Showing results for 
Search instead for 
Did you mean: