3

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 info@server2.myserver.com) 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.

  • you need an SPF at the full domain after @ – Jacob Evans Jan 11 '17 at 3:52
  • What is the envelope sender address of the message? – Michael Hampton Jan 11 '17 at 5:26
1

You have 2 options, depending on if you want people to see @myserver.com only or see that and @server2.mywebsite.com

if you want people to see 2 separate @domain.names then you will need 2 separate SPF records as Jacob Evans has pointed out, one for each domain.

More likely though, if you want multiple servers using the same @domain.name you will want to configure the mail transport agent (MTA) such as postfix, or exim to use a different domain than their own hostname for outbound email. In postfix this setting is called myorigin as described on the postfix site. You can set this parameter by running the command

postconf myorigin=domain.name

If using multiple servers with different public IP addresses you will need an SPF record to reflect that, such as what you have with the a and ip4 mechanisms

v=spf1 a ip4:138.xxx.xxx.148 -all
       ^  ^
   Indicates 2 servers
  • 1
    I'd recommend not using a to save on dns lookups. – Jacob Evans Jan 11 '17 at 5:17

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.