This is a bit difficult to grasp, but here is the thing, SPF is used to specify which IP
addresses and/or servers are allowed to send emails from a particular domain.
Stressing it again, “it specifies which IP are allowed to send emails from a certain domain”
For example, if you have the following SPF value:
“v=spf1 a mx ip4:709.33.44.22 ~all”
This is saying all hosts listed in the MX records are allowed to send emails for your domain (any other domain is not allowed), and all other hosts are disallowed
ip4:709.33.44.22 is the IP address of the mail server or domain that’s authorized to send an email for that domain.
~all - the “all” tag tells the receiving server how it should handle all messages sent from a domain, if it sees a domain in the header that’s not listed in the SPF record. The
tilde (~) with the ‘a’ is a soft fail, this would mark a server that is not listed in the SPF
as spam, you can use -a for a flat out rejection.
v=spf1 include:amazonses.com ~all
In the case of amazon, you make sure are adding the SPF values in every domain you wanna send as, if you want to send as foo.bar.com you add the value in the foo.bar.com records.
If you only wanna send with bar.com, you add the SPF value in the bar.com.
If you added the value in foo.bar.com, and you are sending it from bar.com, it would most likely end up in spam.
So, the TL;DR is SPF Records For Primary Domain doesn’t apply to subdomains and vice versa. you need to have separate SPF records for each subdomain you wish to send mail from.
and I agree with @davidfinley