How to setup spf1 record Using Cloudflare, outlook.com and sending mail directly from php server

domain-name-systemoutlookspf

I have a web server with a community website on it, and 1 subdomain on another ip. I use Cloudflare, and made outlook.com handle my mail for me. However my web server also sends mail. For example, a registration mail, or an invoice. Currently I have my spf record set up as follows:

mydomain.com. IN TXT "v=spf1 include:hotmail.com ~all"

and my mx records point to the hotmail.com mail servers. However, mails send directly from the server seem to be marked as spam rather easily. Probably because the ~all is not a very safe thing to do. How to only include the mail I send? I was thinking of:

mydomain.com. IN TXT "v=spf1 ptr include:hotmail.com -all"

THe ptr record seems to require a correct ip lookup. However, the ip is obfuscated by cloudflare.

How to correctly set up the spf record with cloudflare?

Best Answer

v=spf1 a include:hotmail.com -all

Using a will allow any A record to send email as you stated you have a www site and a subdomain.

Related Topic