SPF for subdomain

Viewed 13011

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.

2 Answers

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.

Related