Is this possible? Like a wildcard TXT record of some sort?

3 Answers 3


Yes, it is possible to define a wildcard TXT record.

Notice that you should define both a TXT RR and a SPF RR. Update: This answer was originally made in 2011. At the time SPF RR was a thing. However, according to RFC7208 the use of SPF RR has been discontinued and SPF content should only be published in TXT records.

In my home I run a local DNS server with the .fbh domain extension, I have created this record:

*.email         IN  TXT "v=spf1 mx -all exp=bad.example.com"

And this gives me the same response for all queries to *.email.fbh:

$ dig +short TXT test.email.fbh
"v=spf1 mx -all exp=bad.example.com"

$ dig +short TXT smth.email.fbh
"v=spf1 mx -all exp=bad.example.com"
  • I was under the impression that SPF RRs were not implemented in the standard yet. Dec 26, 2011 at 1:46
  • 1
    For reference: rfc.frands.net/rfc4408.txt see 3.1.1 Dec 26, 2011 at 1:49
  • What is "RR"? thanks
    – serge
    Apr 29, 2017 at 9:49
  • Old, but for posterity... It means resource record. SPF resource records are now obsolete; just a TXT record will do.
    – Semafoor
    Dec 10, 2019 at 11:53

You can, however, include a central spf record in the invidual subdomain spf records.

Each individual spf records for the subdomains could look like this:

v=spf1 include:_spf.domain.tld ~all

And then add a TXT record for _spf.domain.tld with the actual spf values:

v=spf1 ip4: ~all

This way, you only need to maintain _spf.domain.tld, and not the records for the individual subdomains


there is a way to seting up spf macros now a days. which is mostly used for

SPF macros are a feature of the SPF specification which allow for the creation of dynamic SPF policies. They allow for variables to be included within a policy, which are then evaluated by the receiving MTA and 'filled in' using data from the email being processed, such as the sender address or source IP address.

you can set macros like this also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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