So I’ve finally got around to officially publishing my first WordPress plugin: Mail Integration for Office 365 by Cross Connected – WordPress plugin |

It’s by no means the first plugin I’ve ever written, but to date my exploits have solely focused on developing plugins that meet my own requirements; filling niche gaps that are hardly mass market. However, I think I’ve finally spotted a gap that could have some legs – the ability to connect WordPress to Office 365 to send emails from an Exchange/365 account!

Up until recently it has been possible to connect to Office 365/Exchange server via SMTP. However, Microsoft have now disabled basic authentication over SMTP by default, requiring more modern authentication methods.

You can re-enable basic authentication, but if you use two factor authentication (which you should by the way!), this can cause issues. It is also far less secure than OAuth2 (the authentication protocol this plugin uses), and Microsoft are right to disable it in an age of GPU password cracking and brute force attacks!

Now don’t get me wrong, there are plugins out there that will connect you to Office 365/Exchange. However, the ones I’ve found only provide this through a paid for feature/addon. Given that Office 365 is itself a paid for service, to my mind that is a little annoying.

For this reason I’ve made this free plugin for all to use and hopefully benefit from. It’s a little convoluted to set up, but that’s the nature of OAuth2 I’m afraid. However, if you’re patient and follow the guide found here diligently, you should be able to get it up and running pretty quickly.


Tim Turner · 25th January 2021 at 7:19 pm

Hi Edward,
Not sure where else to try and reach out for support but I’ve followed the guide and have everything setup but when I got to submit my form on my site, I get a “REST API is not yet supported for this mailbox.” message at the top of the page. I know you mentioned about M$ not enabling the graph API to work with free M$ account but I have paid office 365 business account, not even sure this would be related to that or not.

    Edward · 25th January 2021 at 11:49 pm

    Hi Tim, so couple of things come to mind.

    Firstly, are you sure you’re registering the right account with the plugin? Make sure your browser hasn’t saved your personal hotmail/live details and isn’t logging you in with those rather than the account you wish to authorise the plugin with. The easiest way to check this is to open the WordPress admin via an in private/incognito browser window that will force you to enter your login details for the account you wish to authorise after clicking the authorise button.

    Second thing to check if that doesn’t resolve things, is to see if you have your Office 365/Exchange licence assigned to the account you’re attempting to register within the admin portal of 365 (may seem obvious, but you can create a user within 365 with no licences). If you’ve set up a user such as [email protected], or [email protected], these would also need a separate 365 mail licence assigned, unless you set these up as shared mailboxes.

    Third thing to check (which may not be relevant in your case, but still worth checking), is that your account has been migrated over to 365 as explained in this guide:

David Sandil · 29th January 2021 at 2:20 pm

Wonderful plugin. I have configured the plugin as required. Thanks to your detailed steps. It worked for a day may be and then it stopped sending emails. When I go to the plugin page and authorise it again, it get authorised successfully but finally when I press save button, it shows error – ‘Invalid OAuth State’ at the top of the plugin settings page. Any idea?

    Edward · 30th January 2021 at 10:19 am

    Hi David, so if you’re not using version 1.3.0 then that might explain things. A few people were having this issue with version 1.2 but it was resolved in version 1.3.0 (according to the same users). If you are using version 1.3.0, then I’d try removing the plugin completely (making sure you haven’t chosen to remember the credentials in the plugin settings page). Deactivate and then delete the plugin, redownloading it again. It’s unlikely, but I guess possible, that there could be an issue with the transition between 1.2 and 1.3, causing the invalid state error as I changed the way I was recording the state variable in temporary storage between the two versions.

Tyler Reed · 4th February 2021 at 4:23 am

When I click save settings I get this:

Error: Options page mail-integration-365-settings_deactivation_options not found in the allowed options list.

What do I need to fix?

    Tyler Reed · 4th February 2021 at 4:29 am

    Fixed it, followed the instructions on the post above.

Fred · 5th February 2021 at 7:46 am

Greetings! First, thanks for this plugin, it is what I need. BUT I followed the very good instructions, and everything looks good. Until i save the settings, then I get ‘Invalid OAuth State´And in the Office 365 email account trying to send from my WordPress I get delivery failure 550 5.7.708 Service unavailable. Access denied, traffic not accepted from this IP. I suspect I need to do something in Office 365? Im a admin.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.