Search code examples
dnsspfdkim

SPF record won't validate


After noticing that our emails are being delivered to the spam folder on Gmail, even though it only happens with gmail, we are investigating any possible issue.

Now, we are looking into the SPF record, which look like this after a cleanup:

v=spf1 a include:sendgrid.com include:_spf.google.com -all

Tests we run on http://www.kitterman.com/spf/validate.html result in a "Too many DNS lookups in an SPF record" error.

As far as I know, the SPF record there has only 2 dns lookups... and I checked other SPF records, such as Sendgrid's and they have far more lookups and still their test return "Passed".

My SPF record is published both as an SPF and TXT. Am I missing something?

Domain is fulltraffic.net


Solution

  • The sample SPF record has three mechanisms which may require DNS lookups: the "a" mechanism and two "include" mechanisms. This is well below the limit of 10 defined by the latest RFC7208 version (see https://www.rfc-editor.org/rfc/rfc7208#section-4.6.4 and this limitation was already present in RFC4408).

    The culprit here is that "include" triggers a recursive evaluation of the included policy, but the limit is for the complete evaluation (as opposed to per policy). In your case, the included policies define 7 further includes, which in turn define further includes, in overall exceeding the 10 DNS-based term limit.

    You will need to find a way to reduce the number of DNS-based terms, like replacing your "a" mechanism with an "ip4" mechanism.