WordPress Mail and IIS

Feb 17th, 2015

Comments: 0
Category: Uncategorized

WordPress Mail and IIS

I ran into a problem with WordPress mail the other day (the sort of fundamental problem where it doesn’t work at all).  As usual, trying to find information for how to fix this on IIS was not easy – in the end this was the information and fix I came up with.

Natively – WordPress relies on underlying PHP functionality to send mail.  This just didn’t seem to work at all on my site, and I didn’t pursue fixing it because the consensus on the Internet seemed to be that a better way of doing it was to enable SMTP mail.  So I enabled a plugin for this “Easy WP SMTP”.

All was well until I went to configure this – the address that I wanted to send to was on Office 365 which is where I host my production mail.  The plugin had settings for ‘unencrypted, SSL or TLS’ – so I set this to TLS, the port to 567 and the server to live.smtp.com.  Immediately the test function returned an error ‘OpenSSL not configured’.  Of course IIS doesn’t use OpenSSL by default, and a quick look to find whether there were any implementations for it didn’t turn up anything which looked modern, supported and functional.  So with the mail I wanted to send not being sensitive, I tried unencrypted and set the port to 25.  But Microsoft don’t accept unencrypted mail any more (I suspect none of the tech giants do).

So as a workaround, I did this (not very elegant).  I added an SMTP server to Windows on the IIS box (this is a ‘feature’ in add roles and features).  This adds some old IIS 6 functionality including a basic SMTP server.  So in the properties for this (under Administrative tools,  IIS 6 Management, SMTP Server, properties) you go to the ‘Access’ Tab and under ‘Relay Restrictions’ grant access to (the local server).  You do not need to configure a domain or any other setting.  Then in WordPress, in the WP SMTP setting, set the server to with no encryption.

What now happens is that WordPress sends the mail to the local server unencrypted, the local server looks up the recipient address and relays it to the encrypted port in Office 365.  What slightly surprised me is that Microsoft accepts the mail without any further configuration, I was expecting to have to do some further playing around with my Office 365 configuration.

Not elegant but easy and works….

Add a comment

Your email address will not be shared or published. Required fields are marked *