For the record, let me state that I am not a DNS expert and this may seem simple for someone that is. But since I could not find anything to help me resolve this problem, I figured I would blog about it to possibly save someone else the headache that I encountered.
The other day I was working on an SPF record for a client that was over 255 characters. This is the limitation for TXT records in DNS for each string. I spent quite a while working on this and tried every iteration I could think of to get it to work. I even found quite a few articles that talked about breaking the records into multiple strings but could not get that to work. So I settled for creating a new subdomain within the domain and adding part of the text to an SPF record in the subdomain. I then used the include:subdomain feature within the record. This worked perfectly as a way to get around the issue. The client, however, did not like this solution. So back to the drawing board.
I am a literal person. If it is a string, I make it a string by using quotes. This is also how the examples showed it. That, needless to say, is not what needs to be done. Long story short, if you need to break an SPF record into multiple strings, here is how it is done.
- Create the new TXT record in DNS Manager
- Add the first part of the record (up to but not exceeding 255 characters)
- Hit enter within the record to start a new line.
- Add a space and then the next portion of the record up to but not exceeding 254 characters.
- Repeat step 4 until all data is in the record.
- Save the record
You can then use a site like MXToolbox to verify the SPF record. If the record is correct, you will receive output that looks like this:
If any portion of the SPF record is incorrect, you will get an error and additional text which points to the problem with the record. If the record contains any string that is over 255 characters, you will receive an empty response.
At the end of the day, the client was happy and I learned something as well.