Send email using Microsoft Graph Mailer

Use this guide if you want to configure the WPO365 | MS GRAPH MAILER and send transactional WordPress emails from one of your Microsoft 365 Exchange Online / Mail enabled accounts using Microsoft Graph instead of - for example - using SMTP.

The  WPO365 | MS GRAPH MAILER plugin for WordPress is a spin-off and derived from the popular  WPO365 | LOGIN plugin that allows your WordPress website users to sign in with their corporate Azure AD / Microsoft Office 365) account: No username or password required.

If your intention is to connect WordPress and Azure AD / Microsoft 365 beyond the scope of just sending emails then please remove the WPO365 | MS GRAPH MAILER plugin and instead install the WPO365 | LOGIN plugin (which includes the exact same email sending functionality plus a lot more e.g. to enable single sign-on and user synchronization).

Features

WPO365 | MS GRAPH MAILER (Free)

  • Delivery Send WordPress transactional emails from one of your Microsoft 365 Exchange Online / Mail enabled accounts using Microsoft Graph instead of - for example - SMTP.
  • Save to Sent Items Emails sent will be saved in the Microsoft 365 account's mailbox in the Sent Items folder, further helping to track (successful) mail delivery.
  • Send as HTML Send emails formatted as HTML.
  • Attachments Send files from your WordPress website as attachments.
  • Configuration / Test Easy configuration with detailed step-by-step Getting started guide and ability to test the configuration by sending a test email to various types of recipients incl. CC, BCC, optionally with attachment.

WPO365 | MAIL (Paid premium extension)

  • Mail audit / resend Log every transactional email sent from your WordPress website, review errors and try to send unsuccessfully sent mails again.
  • Send as BCC Send emails as BCC instead and prevent reply-to-all mail pollution.
  • Reply-to Configure a default reply-to mail address if this should differ from the account's mail address that is used to send WordPress transactional emails from.

Visit our website for details and pricing.

Before you start

  • You are a Global Administrator for your company’s Microsoft 365 tenant / Azure AD directory (or have at least the ability to register a new application in Azure Active Directory.
  • You are an Administrator for your WordPress website.

App registration

  • In Azure Portal click the 'hamburger' (icon with three horizontal lines in the upper corner) to open the menu.
  • Navigate to Azure Active Directory > App registrations.
  • Click + New registration.
  • On the Register an application page appears, enter your application’s registration information.
    • Name Enter a meaningful application name that will be displayed to users of the app.
    • Supported account types Select Accounts in this organizational directory only
    • Redirect URI Leave empty
  • Click Register to create the App registration in Azure AD.

API Permissions

  • Click API permissions from your App registration's menu on the left.
  • Remove the User.Read permission by selecting Remove permission from the menu on the far right.

  • Click + Add permission.
  • Select Microsoft Graph > Application permissions.
  • Scroll down to Mail and check
    • Mail.Send
  • Click  Add permissions.

  • Wait until Grant admin consent for … has become available, then click to grant consent for all users in your tenant to use this ‘App registration’.
At this point you must be aware of the fact that you have now granted an application identity the unlimited permission to send emails as any user in your organization and ensure that you have taken sufficient precautions to protect your website against attacks.

Configure integration with Microsoft Graph

  • Leave the browser tab with the App registration that you just created open.
  • Open a new browser tab and go to WP Admin > Plugins > All plugins and ensure that you have disabled all other email sending plugins.
  • Navigate to WP Admin > WPO365 > Mail for the plugin's Mail configuration page.
  • Switch to the tab with your App registration and click Overview from your App registration's menu on the left.
  • Copy the Directory (tenant) ID and Application (client) ID from the Overview page of your App registration to the corresponding fields on the plugin's Mail configuration page.

  • Switch to the tab with your App registration and click Certificates & secrets from your App registration's menu on the left.
  • Click + New client secret.
  • Enter a description and choose how long the secret should be valid for e.g. 6 months (make a note of the expiration date and ensure that renew the secret before it expires) and click Add when finished.
  • Copy the Value (not the Secret ID) of the Client secret from the Certificates & secrets page of your App registration to the corresponding field on the plugin's Mail configuration page.

Configure the Microsoft Graph Mailer for WordPress

  • To reconfigure your website and Send WordPress emails using Microsoft Graph you must check the corresponding option.
  • Next you must enter the user principal name (= Microsoft login name) of a Microsoft 365 Exchange Online / Mail enabled account that will be used to Send mail as / from.
  • Developers who have installed WordPress on their localhost, may check Fix WordPress@localhost issue to prevent WordPress from trying to send emails from WordPress@localhost which eventually will result in an error.

Test the Microsoft Graph Mailer for WordPress

  • To test the configuration you can enter comma separated email addresses for the following recipients:
    • To recipients
    • CC recipients
    • BCC recipients
  • Optionally you can also add an attachment when sending the test email.

  • Finally click Save configuration + Send test email and wait for the corresponding Feedback.

Adding premium features

You can unlock the premium features by purchasing the WPO365 | MAIL extension (see our website for details and pricing). The extension must be installed in addition to the WPO365 | MS GRAPH MAILER plugin.

Configure premium features

  • You can send emails with a Reply-to address that is different from the address sending the email.
  • From the dropdown you can choose to Send email formatted as HTML.
  • When you check the option to Save to Sent Items all emails sent will be saved in the Sent Item folder of the mailbox used to send emails from.
  • If you are regularly sending emails to multiple (CC) recipients you can Send to BCC instead. When you check this option all to and CC recipients will be configured as BCC recipients instead and the email will be sent to the Default To: recipient's email address that you must enter in the corresponding field.

Mail Audit / Resend

If you check the premium option to Log all emails sent from your WordPress website, the plugin will save all sent items in the database.

When you checked this option, a link to View logs will be shown and allow you to review errors and try to send unsuccessfully sent mails again.

Troubleshooting

If the test email was not sent successfully you may check the plugin's debug-log for any errors.

You can reach the WPO365 team for support and questions in one of the following ways:

  • Click the Contact link at the top of this page.
  • Use the Beacon by clicking the question mark in the blue dot on the plugin's configuration page.
  • Fill out the Contact Form on the website.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us