I have two servers.
The first server uses a hostname of myserver.com, and I set the A record for myserver.com as the IP address of the first server.
The second server uses the hostname server2.myserver.com, and I set the A record for server2.myserver.com as the IP address of the second server.
The second server, a DigitalOcean droplet (CentOS), hosts a simple WordPress website, mywebsite.com and a couple of other sites. The IP is 138.xxx.xxx.148.
When a message is sent from the contact form on mywebsite.com, it arrives in Gmail spam. The SPF check is "neutral" and the message it says is:
Received-SPF: neutral (google.com: 138.xxx.xxx.148 is neither permitted nor denied by best guess record for domain of firstname.lastname@example.org) client-ip=138.xxx.xxx.148;
I have added an SPF record for mywebsite.com: v=spf1 a ip4:138.xxx.xxx.148/32 a:server2.myserver.com ~all
And I added the same SPF record for the myserver.com.
Somewhere here I must be making an error but cannot seem to figure it out. Perhaps I simply cannot use the same domain name as the hostname for both servers?
I have tried several combinations of IPs and domains within the spf record, across the website domain and server domain, without success.
Thanks in advance for any help you can provide.