My mail server is running at for example mail.example.com and I have set an SPF record for example.com using v=spf1 mx -all. example.com also has its MX record set as well.

Now I have other domains which use the mail server to send emails, but their MX records are set to mail.example.com.

Do I need to set each domain a SPF record like v=spf1 mx -all or does it only relate to the mail server which is at mail.example.com?


Of course you must set two records.

For example if the two domains example.com and example.org share the mail server mx.example.org you need two TXT records with the same content (as you wrote v=spf1 mx -all).

One of them goes to the zone file of example.com and the other goes to the zone file of example.org.

Afterwards the following two dig calls should yield the correspondig record as output.

For example.com:

dig example.com txt
example.com.     3600   IN   TXT   "v=spf1 mx -all"

And for example.org:

dig example.org txt
example.org.     3600   IN   TXT   "v=spf1 mx -all"
  • Arhh right ok, so just to confirm... Any domain which shares and sends mail from the same server like info@example.com or joe@domain.com will need the same SPF record? – Erdss4 Oct 14 '17 at 12:56
  • Right. If you add an mx record to the zone file of example.co.uk you have to put also the same txt record there. – blafasel Oct 14 '17 at 13:32

You use MX records for receiving mail while SPF is a technology related to sending mail. The SPF record is checked against the address used in the envelope sender address (i.e. the MAIL FROM command), not against the HELO hostname of the mail server.

Therefore, you should have a SPF record for every domain used for sending mail and it should include every IP address that is permitted to send mail for that domail. The +mx in the SPF record is just an alias for every hostname the domain has as an MX record. The ip4/ip6 mechanisms are recommended to be used, instead.

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.