Making sure Outlook.com receives PHP Mail() emails

During the recent development of bethanyjackson.co.uk I had found my current setup of Postfix which is used by PHP Mail() was not sending email correctly to Microsoft email services such as Outlook.com.

Emails were being sent by my web server but never received by Outlook.com or placed in the Junk folder, even though emails were received fine by Gmail with the same server settings.

I found some help on various websites regarding this issue which I have now implemented on my server, I have posted the configuration below which I now working for me.

These steps below have been tested on a Digital Ocean VPS running ZPanel 10.1.0.

1. The first step is to check your domain and/or IP address is not listed on a spam block list. Use http://www.spamhaus.org/lookup/ to check for blocked domains and IP addresses. If the domain and/or IP address is listed on a spam block list, then it should be removed.

2. Add a Windows Sender ID SPF record to your domain’s DNS settings. This helps Microsoft services to understand your domain and/or web server IP address is not used for sending spam emails. This can be setup at this web address: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/ [Link no longer available: 23/07/2016].

3. Always make sure there is a valid ‘From:<email@domain.com>’ address in the headers of your PHP Mail() code. It must be a full email address and not just a domain, an example of the correct script setup is below:
4. Then edit your ‘main.cf’ Postfix file, usually stored in ‘/etc/postfix/’ on your web server. Starting on line 23, your network settings must be the same as below. Replace ‘yourdomain.co.uk’ with your domain name.

Comments

Tom Byford
  • April 27th, 2014

Thanks for posting this, it’s really helped me when setting up my new web server.

🙂

Brad Stone
  • July 10th, 2014

Hi, When setting up the server, will the above code work on a Windows 2008 server? or is this just for Linux. Any help would be great, thanks. Although I guess it will work on both because this is PHP code? Thanks

Ryan
  • July 27th, 2014

Hi Brad, the code should work on any server which uses the PHP mail function.

Post a Comment