Skip to content

WordPress Contact Forms and Microsoft 365

Problem Statement

Email to Microsoft 365 and other platforms with modern security authentication policies filter mail sent from WordPress as junk/spam.

Problem Explanation

Websites built in WordPress that have a contact form or another form mailers on the site typically use the built-in php mail() function to send messages from forms inside WordPress site to end-users on the Microsoft 365 mail plan. Using php mail() instead of the authorized mail relay for whatever mail service the domain is using (Microsoft 365 for example) will cause a mismatch between the sending server (WordPress) and the expected sending server (Microsoft 365) for a given domain.

This problem becomes even more problematic if Proofpoint (AES) is involved and filtering mail as well. But the solution below is the same.

Example

cooldomain.com (WordPress site) has a contact form configured to send email to customers as donotreply@cooldomain.com but the customer also has a Microsoft 365 email plan on cooldomain.com for regular business email.

Solution

WordPress must be switched from using php mail() as the SMTP relay to using Microsoft 365 as the SMTP relay.

Plugin Installation:

  1. Navigate to Plugins → Add New Plugin

  2. Search for Fluent SMTP

  3. Install and Activate this plugin

  4. Go to Settings > Fluent SMTP in WP Admin

  5. Hit Skip

  6. Select the Microsoft tile from the service provider selection page

  7. Enter the From Email and From Name that emails should come from.

    • This should be the Microsoft 365 email, and it should be a real user in Microsoft 365.

  8. Copy the App Callback URL

  9. Search for the customer’s tenant in Microsoft Partner Center

  10. Click Entra ID for the customer to launch the Entra portal for this tenant

  11. Click Applications > App Registrations

  12. Click +New Registration

  13. Enter Fluent SMTP for the name

  14. Select Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)

  15. Paste the copied App Callback URL in the Redirect URI field (this was Step 8 above)

  16. Choose Web on the Select a platform dropdown menu

  17. Click Register

  18. Copy the Application (client) ID from Entra and paste it into the Application Client ID field on the Fluent SMTP setup page

  19. Go back to Entra and click Add a certificate or secret next to Client Credentials

  20. Click New client secret

  21. Enter Fluent SMTP for the description

  22. Choose 730 days (24 months) next to Expires

  23. Click Add

  24. Copy the secret in the Value column in Entra and paste it into the Application Client Secret field on the Fluent SMTP setup page

  25. Click Authenticate with Office365 & Get Access Token

  26. Enter the Microsoft 365 email address you entered for From Email in Step 7

  27. You will be redirected to GoDaddy’s SSO to enter customer Microsoft 365 email password

  28. Copy the entire Access Token (triple click in windows to select all, then copy)

  29. Paste the Access Token in the Access token field in Fluent SMTP and click Save Connection Settings

  30. To the right in Fluent SMTP, ensure Outlook for Office 365 is selected for the Default Connection

WordPress should now send through Microsoft 365 instead of php mail().

Bender-led Solution (Requires Admin Permissions)

WordPress Plugin Installation:

  1. Open a new Incognito window

  2. Skip in the the account in CRM.

  3. Skip into the customer’s WP Admin

  4. Pull the tenant in Bender and ensure MFA or SecDef is off for the user we are going to authenticate.

  5. Navigate to Plugins → Add New Plugin

  6. Search for Fluent SMTP

  7. Install and Activate this plugin

  8. Go to Settings > Fluent SMTP in WP Admin

  9. Hit Skip

  10. Select the Microsoft tile from the service provider selection page

  11. Enter the From Email and From Name that emails should come from.
    • This should be the Microsoft 365 email, and it should be a real user in Microsoft 365.

  12. Copy the App Callback URL

  13. In Bender, go to the Tenant Dash

  14. Click the Azure App Registration tile

  15. Enter the App Callback URL from Step 8 and click Create App Registration

  16. Copy the Client ID (Application Client ID) and the Client Secret (Application Client Secret) from the Bender response and paste them into the Fluent SMTP Plugin Setup page in WP Admin.

  17. Click Authenticate with Office365 & Get Access Token

  18. Go to cAuth and search for the customer

  19. Skip into the customer’s M365 Mailbox

    • Note: If the customer has Security Defaults, you will need to temporarily disable it to skip into their M365

  20. Go back to the Fluent SMTP plugin and click Authenticate with Office365 & Get Access Token

  21. Copy the entire Access Token (triple click in windows to select all, then copy)

  22. Paste the Access Token in the Access token field in Fluent SMTP and click Save Connection Settings

  23. To the right in Fluent SMTP, ensure Outlook for Office 365 is selected for the Default Connection and Save again.

Table of Contents
    Scroll To Top