Friday, April 3, 2015

php - How to configure SPF and DKIM to prevent mail going to spam folder



When creating a mail with PHPMailer my emails are getting sent to the spam folder of my recipients mailbox



I have been told I need to configure my SPF and DKIM correctly, I think I have done this already on my GoDaddy account for SPF - @ v=spf1 a mx ptr include:secureserver.net ~all



Has anyone else got any ideas why my mail might be going to spam? Have I missed out any headers that you can tell?



Thank You




Thanks for your help


Answer



The reason for the failure is:



Authentication-Results: hotmail.com; spf=softfail (sender IP is 184.168.200.138) smtp.mailfrom=no-reply@example.com; dkim=none header.d=example.com; x-hmca=fail header.id=no-reply@example.com


The IP address 184.168.200.138 does not appear in your SPF record as either a (23.229.191.2), mx(mail.example.com which resolves to 23.229.191.2), ptr (p-23-229-191-2.ip.secureserver.net), or the stated domain of secureserver.net.




There may be other solutions, but one simple one is to add the IP address 184.168.200.138 to your SPF record.



v=spf1 a mx ptr IP4:184.168.200.138 ptr:secureserver.net ~all



You can test SPF records at http://www.kitterman.com/spf/validate.html. My previous edit of using the include mechanism is not correct because secureserver.net does not have a valid SPF record. Apparently the record for example.com has already been changed to something similar to the above recommendation using the ptr and IP4: mechanisms.



No DKIM header is present. You can test your DKIM configuration at http://dkimcore.org/tools/ among other places, but the problem of the header not being present is a server configuration issue that is probably resolved by referring to the documentation for the various tools you are using.



It is also important to note that there is no guaranteed way to not arrive in spam folders other than to develop a good reputation and gain the trust of the various email providers. SPF and DKIM help primarily because they offer some protection against spammers that may try and use your domain in their spamming efforts.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...