问题原文
原帖链接 · Neograph734 · CC BY-SA 3.0
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?
已采纳解答
原帖链接 · MrWhite · CC BY-SA 4.0
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 often the case with SPF and DKIM records). Spaces are otherwise delimiters in the DNS Zone file.
RFC 1035 defines how values should be quoted in the Zone fine. With regards to TXT resource records:
3.3.14. TXT RDATA format
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / TXT-DATA / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+where:
TXT-DATA One or more
<character-string>s.
[Page 20]
<character-string>is expressed in one or two ways: as a contiguous set of characters without interior spaces, or as a string beginning with a " and ending with a ". Inside a " delimited string any character can occur, except for a " itself, which must be quoted using \ (back slash).
[Page 35]
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.
Further Reference:
https://en.wikipedia.org/wiki/TXT_Record
https://www.rfc-editor.org/rfc/rfc1464
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
