10

I have been searching for some hours now, but multiple sources say different things.

https://support.wordfly.com/hc/en-us/articles/204767474-How-do-we-publish-DKIM-and-SPF-in-our-DNS- States I should not include quotes, whereas https://stackoverflow.com/a/9784925/1293725 reads quotes should be included in these TXT records.

These are just some examples of sources, but there are many more.

So should these records include quotes or not?

  • 2
    It really depends upon your system/set-up. For example. I am assuming with wordfly you are entering your values in a web form. Using quotes in a form can really mess things up. So it is likely that the process assumes quotes and enters the values using quotes in the DNS as it should on your behalf. – closetnoc Nov 21 '15 at 0:22
  • 2
    @closetnoc is correct. Whether you use quotes or not likely has more to do with the site/tool that you use to enter them. – Sherwin Flight Nov 21 '15 at 3:12
  • Thanks, I'll give it a try with quotes included first then and see if the system throws an error. I found it confusing as sources indicate spaces in TXT records make each word to be treated as an individual string and I could not figure out whether or not that was the intended behavior for SPF and DKIM. But I understand now it should be treated as one string. – Neograph734 Nov 21 '15 at 8:17
  • I had quotes, moved my DNS to a new provider (Azure DNS), and SPF stopped working. Removed the quotes and everything worked again. So it depends on the provider. Make sure you verify the the record. The entity you're creating the SPF record for usually has a tool/button to do this. – nmit026 Aug 4 '17 at 0:10
9

In the (raw) DNS zone file, the value of a TXT record needs to be enclosed in double-quotes if it contains spaces (as is the case with SPF and DKIM records).

However, as mentioned in comments, you often use another tool to edit DNS records (you don't usually edit the DNS zone file directly, although WHM does give you this option). This other tool will probably handle the quotes and any additional escaping that is required to make the record valid. If you manually surround the value in quotes when submitting the value using your editor/tool then these additional quotes might be escaped and become part of the TXT record value.

Incidentally, when you do a DNS lookup, you are seeing the parsed/unquoted string value.

Reference:
https://en.wikipedia.org/wiki/TXT_Record
https://tools.ietf.org/html/rfc1464

  • Yes, after reading the comments I've found a manual on my registrar's site as well, stating the records should be entered without quotes (though I had them with quotes earlier and online validators marked them as valid so perhaps both ways worked in my case). I have switched to the recommended format of my registrar. Thanks all for the help! – Neograph734 Nov 23 '15 at 0:03
  • Yes, Cloudflare also has a specific note about quotes support.cloudflare.com/hc/en-us/articles/… – lkraav Jul 25 '18 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.