This is a followup to question: Some advise needed on how to setup reverse PTR on web and mail server

So i've decided to use my www subdomain for both www and mail. My current problem is not knowing where to put the spf record for that. I've scoured other postings on this subject but i'm still not sure. I had the original put under my maindomain.com:

v=spf1 a mx ip4: -all

But it doesnt seem to work for my www.maindomain.com (even though that's the right ip address for it). I get spf failed in my mailheaders. I use dynadot as a name registrar. There's a domain record entry and a subdomain record entry.

Do i need to change either the top record, or do i need to add a SPF record for the www.mydomain.com, under the subdomain record entries. If so, how ? Do i add www subdomain, choose a TXT record and add the above SPF record (even though i already have a www A record subdomain)

Thank you for helping me out with this seemingly basic question.


Assuming remote clients would send messages to toto@example.com, then you need to set your SPF record on example.com itself, regardless of which MXs are involved.

With the names you're using in your post, you would add your SPF record for mydomain.com

  • Right. So i did that, but outlook (the domain i'm sending to) still flags it as spam and not a valid spf record. – ATv May 25 '17 at 11:40
  • Can you update your post with the received message headers (that should mention something about SPF failing, and the path your message took)? Looking at mxtoolbox.com for grabaguru.com (am I right to assume this is yours?), SPF looks fine. – SYN May 26 '17 at 12:28
  • Sidenote: your MX being the sole IP listed, then you could set your SPF record to v=spf1 mx -all – SYN May 26 '17 at 12:30

I think some clarification needs to take place. SPF records are for mail being sent out from you. It applies to the zone that mail is being sent from (i.e., the "domain" part of the address). If your domain is example.com and you're sending a message from a "normal mail client" as joe.blow@example.com, you would have a TXT/SPF record for example.com. If you're sending mail from your web server as web.server@example.com, that one TXT/SPF record will cover that just fine, provided the IP addressing information you specify is correct (e.g., covers your web server and your mail server). Let's say your mail server is and your web server is You could have two separate entries in your TXT record: ipv4: and ipv4: (or if you want to use CIDR, just ipv4:

You would only need a special "www" TXT/SPF record if you were sending mail from web.server@www.example.com. In that case, I would suggest having only one "main" TXT/SPF record, but just refer to it from your www record.

In BIND it might look like this:

@   IN TXT "v=spf1 a mx ip4: ip4: -all"

www IN A
www IN TXT "v=spf1 redirect=example.com"

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.