I need to configure SPF record for a subdomain.
DNS for the main domain (I use Google Mail):
IN MX 1 aspmx.l.google.com.
IN MX 10 aspmx3.googlemail.com.
IN MX 10 aspmx5.googlemail.com.
IN MX 10 aspmx4.googlemail.com.
IN MX 10 aspmx2.googlemail.com.
IN MX 5 alt1.aspmx.l.google.com.
IN MX 5 alt2.aspmx.l.google.com.
IN TXT "v=spf1 ip4:xx.xxx.xxx.xx include:_spf.google.com ~all"
mysubdomain IN A xxx.xxx.xxx.xxx
But how to set SPF for mysubdomain.example.com ? I will send email newsletter from this subdomain using phpmail.
Also online email checkers show warning that there is no MX record for my subdomain.
Just add the subdomain in front of the SPF record:
mysubdomain IN TXT "v=spf1 ip4:xx.xxx.xxx.xx include:_spf.google.com ~all"
Similarly, you can set a separate MX, though you don't necessarily need one if it's the same as for the domain:
mysubdomain IN MX 1 aspmx.l.google.com.
mysubdomain IN MX 10 aspmx3.googlemail.com.
I will amend accepted answer regarding record type.
If you try to amend CNAME type subdomain, e.g. www2
which points to A type record for www.mydomain.tld.
with TXT type record, you will get error like
zone mydomain.tld/IN: loading from master file mydomain.tld.zone failed: CNAME and other data
This may not sound very clear, but it means, that domain you are trying to amend is CNAME type record, which does not allow any complementary records to it.
To resolve that, you can either change CNAME to A type record, or create complementary TXT records for the CNAME target (A) record.
Hope it helps somebody, and save some time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With