Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPF for subdomain

Tags:

subdomain

spf

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.

like image 578
Igor Avatar asked Dec 03 '22 12:12

Igor


2 Answers

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.
like image 106
Synchro Avatar answered Mar 20 '23 05:03

Synchro


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.

like image 39
Arunas Bartisius Avatar answered Mar 20 '23 06:03

Arunas Bartisius