Microsoft 365 /

Microsoft 365 / is a Pro Feature

Unlock Microsoft 365 / and other powerful features to grow your business.

Get WP Mail SMTP Pro

Would you like to use your Outlook and Microsoft 365 account, including Exchange Online, to improve email deliverability for your WordPress site? The Microsoft 365 / mailer for WP Mail SMTP lets you securely use Microsoft’s API to authenticate your site’s emails.

This tutorial will show you every step needed to set up the Microsoft 365 / mailer in WP Mail SMTP.


  • This mailer requires your site to have SSL (https) enabled. For setup details, please see WPBeginner’s guide to adding SSL and HTTPS in WordPress.
  • While this mailer setup does not require the use of any paid Microsoft services, Microsoft will require that you enter a credit card to set up an account (to reduce spam signups).
  • The Microsoft 365 / mailer is only available with the Pro license or higher.

What Is the Microsoft 365 / Mailer?

Microsoft offers not only email address/inbox services but also a tool to improve the deliverability of your emails. They do this through an API, which means that you don’t have to enter any sensitive login details into your WordPress admin area (which is more secure than a traditional SMTP). The Microsoft/Outlook mailer can send up to 1,000 emails per minute, which is much higher than the limits on most other mailers.

  • Cost: Free.
  • From Email Requirements: The free service only works with Microsoft-based email addresses (e.g., [email protected], [email protected], and Office 365 emails, including those managed by Exchange Online). If you’re using Exchange Server, only paid Outlook (Office 365) accounts can use a domain-based From Email address.
  • Bottom Line: Microsoft’s API is a free, secure solution for email delivery. However, Microsoft’s setup requirements are more complex than most other mailer options in WP Mail SMTP. Also, the API tends to cause minor delays (up to a couple minutes) in email deliveries.

Note: If you are using a paid account with a domain-based From Email, you will need to configure the SPF and DKIM values. Please see Microsoft’s SPF documentation and DKIM documentation for further information.

Getting Started with WP Mail SMTP

To get started, you’ll first need to install and activate the WP Mail SMTP plugin.

Once you’ve installed and activated the plugin, go to WP Mail SMTP » Settings. Under the General tab, you’ll see mailer configuration settings.


We’ll cover how to complete these settings in the next sections.


Go ahead and skip the From Email and From Name settings for now. We’ll cover these in a later step.

You’ll first want to scroll to the Mailer section. From here, select the 365 / Outlook option.

Select Outlook mailer

Now that you’ve chosen the Microsoft 365 / mailer, you should see a new section appear titled 365 / Outlook.

365 Outlook section

To generate the information needed for this section, you’ll need to set up a web application in your Microsoft Azure account. This process doesn’t require any coding, and we’ll show you exactly what to do in the next step.

Be sure to keep these WP Mail SMTP settings open in a separate tab or window, as you’ll come back to them soon.

Configuring a Microsoft Azure Account

In order to move forward with the setup process, you’ll need to have a Microsoft Azure account.

Since you most likely already have a Microsoft email account (through Hotmail, Live, Outlook, Microsoft 365, etc), you can simply log into Microsoft Azure with your existing account credentials.

If you need to create a new account, click this link to sign up for a free Microsoft Azure account.

Note: The email you use for your Azure account must be a Microsoft-based email address with email-sending permissions.

Next, you’ll need to open the Azure Portal, if you’re not automatically redirected.

Create an Application ID

Once the Azure Portal is open, type App registrations in the search bar at the top of the page.

Search app registrations

Next, you’ll see a dropdown menu with a list of services. Go ahead and click on App registrations.

Click app registrations

At the top of the App Registrations page, you’ll need to select the + New registration option.

Click on New Registration

In the app registration form, here are the details you’ll need to fill out:

  • Name: This is only for your personal organization, so we recommend naming it something like “WP Mail SMTP:”.
  • Supported account types: Select Accounts in any organizational directory and personal Microsoft accounts.

Example of app registration form in Microsoft

Note: For some Microsoft account types, you may only see the Accounts in any organizational directory (Any Azure AD – Multitenant) option. Go ahead and select this option if the Accounts in any organizational directory and personal Microsoft accounts option doesn’t appear for your account type.

  • Redirect URI: For the first dropdown, leave this set to Web. Then for the second field, you’ll need to copy this value from your WP Mail SMTP settings (see below).

In order to find the Redirect URI, you’ll need to switch back to the tab or window where you left your site’s WP Mail SMTP settings open. Under the Outlook / 365 section, you’ll see a field named Redirect URI.

Copy Redirect URI from WP Mail SMTP settings

You’ll need to copy this value, then paste it into your Microsoft Azure app registration form. Be sure to still keep both windows/tabs open in your browser, as we’ll continue to switch between the two.

Finish app registration form in Microsoft

When you’re ready, click the Register button to proceed.


Note: After you’ve registered your application, be sure to double-check your Supported account types and Redirect URI, located under the Authentication tab. If these settings are configured incorrectly, you’ll likely experience issues authorizing WP Mail SMTP.

As soon as this registration form is submitted, you’ll be redirected to the Overview page. Here, you’ll find your Application (client) ID. Go ahead and copy this value.

Copy Application ID from Microsoft

Once you have the Application (client) ID copied, you’ll need to paste this full value into your WP Mail SMTP settings, in the field labeled Application ID.


Create an Application Password

Next, we’ll need to generate a password for this app. To do that, click on Certificates & secrets in the left sidebar.

Open Certificates and Secrets menu item

On this screen, click on the + New client secret option.

Create a new client secret in Microsoft settings

An overlay will appear, and here you’ll need to fill out a short form:

  • Description: This name is only for your own use, so we recommend a logical and simple name, such as app_password.
  • Expires: 730 days (24 months).

Add a client secret

After you submit the client secret form, the Application Password will be generated. Go ahead and copy the password under the Value column (not the Secret ID column), and head back over to your WP Mail SMTP settings.


Note: You won’t be able to access the Value after you exit this page. We recommend storing the value in a secure location in case you need to access it again.

Once you’ve returned to the tab or window where your settings are still open, paste this value into the Application Password field.


Saving Settings and Authorizing WP Mail SMTP

Once you’ve added your Application ID and Application Password, click the Save Settings button at the bottom of the page.

Save WP Mail SMTP settings

After you’ve saved the settings, you’ll need to scroll down to the Authorization section. You should now see a button labeled Allow plugin to send emails using your Microsoft account. Go ahead and click this button.


Once you’ve clicked the button, you should be redirected to a Microsoft permissions form.

Microsoft permissions request form

At the bottom of this form, click Yes.

Next, you will be redirected back to your WP Mail SMTP settings. At the top of these settings, you should see a notification letting you know that you’ve successfully connected your Microsoft account.

Microsoft API has been successfully connected

Then, in the Authorization section at the bottom of the page, you should also see the name and email address that you used to authorize the connection.

Name and email for connection

From Email

Now that your Microsoft API is set up and connected, you can now enter a From Email address. You will need to use the same email address that you used to authorize your connection. This email address can be found in the Authorization section of your settings.


Go ahead and enter this same email address in the From Email address field in your settings.

Note: If you’d like to send emails as a different user, shared inbox, or group, be sure to check out our FAQ section to learn how.

We also strongly recommend checking the Force From Email box. Selecting this option will prevent you from having to edit the From Email settings in other areas of your site.


Note: For more details, see our guide to understand how the Force From Email setting works.

From Name

The Microsoft 365 / mailer doesn’t support changing or forcing the From Name. Your emails will be sent on behalf of the account name used to authorize the connection.


Backup Connection

Setting up a Backup Connection is optional and isn’t required to complete your Microsoft 365 / Outlook mailer setup. However, to further improve email deliverability, we recommend configuring an additional connection to serve as a backup in case your Primary Connection fails.


Note: Want to route your emails through a specific additional connection based on a set of rules or conditions? Be sure to check out our tutorial on Smart Routing to learn how.

Sending a Test Email

Now that your Microsoft API is set up and connected, it’s important to send a test email to ensure that everything is working properly. To do this from the WordPress admin dashboard, go to WP Mail SMTP » Tools and click on the Email Test tab.


In the Send To field, you’ll see the site’s admin email address by default. However, feel free to change this email address to any email address you’d like to send the test email to.

Note: If you’ve set up an additional connection, you’d be able to choose between your Primary Connection and other connections when sending a test email.

Next, click the Send Email button to send your test email.

Click send email button

After sending the email, you should see a success message.

Wp Mail SMTP test email success message

If you check the inbox for that email address, you should receive the email for this test.

Successful test email from WP Mail SMTP

Frequently Asked Questions

I use Two Factor Authentication / Multi Factor Authentication (2FA / MFA) on my Microsoft-based email account. Will that work with the Microsoft 365 / mailer?

If you already have 2FA/MFA configured before completing the setup steps in this tutorial, then you shouldn’t run into any issues (just follow the steps as normal).

If you complete this tutorial and then decide to later enable 2FA/MFA, however, then in most cases you’ll need to re-authorize the mailer (see Saving Settings and Authorizing WP Mail SMTP).

What is the maximum email size that can be sent through the Microsoft 365 / mailer?

For WP Mail SMTP versions 3.3 and earlier, the maximum size limit is 4MB.

For any WP Mail SMTP versions greater than 3.3, the maximum size limit will depend on your Outlook configuration.

If you’ve updated the WP Mail SMTP plugin to a version greater than 3.3 and plan to send emails larger than 4MB, you’ll need to re-authorize the mailer (see Saving Settings and Authorizing WP Mail SMTP).

Why do I receive the following error when setting up an Office 365 GCC or DoD email address?

Confidential Client is not supported in Cross Cloud request

For security measures, Government Community Cloud (GCC) and U.S. Department of Defense (DoD) accounts typically use the .us domain extension instead of .com. In order to set up these types of accounts, you’ll need to add the following code snippet to allow for .us domain extensions:

function theme_prefix_enable_gcc_high_and_dod_compatibility( $country_code ) {

	add_filter( 'wp_mail_smtp_pro_providers_outlook_auth_authorize_url', function ( $url ) use ( $country_code ) {
		return str_replace( '', 'microsoftonline.' . $country_code, $url );
	} );

	add_filter( 'wp_mail_smtp_pro_providers_outlook_auth_access_token_url', function ( $url ) use ( $country_code ) {
		return str_replace( '', 'microsoftonline.' . $country_code, $url );
	} );

	add_filter( 'wp_mail_smtp_pro_providers_outlook_auth_resource_owner_details_url', function ( $url ) use ( $country_code ) {
		return str_replace( '', 'microsoft.' . $country_code, $url );
	} );

	add_filter( 'wp_mail_smtp_pro_providers_outlook_auth_get_scopes', function ( $scopes ) use ( $country_code ) {
		return array_map( function ( $url ) use ( $country_code ) {
			return str_replace( '', 'microsoft.' . $country_code, $url );
		}, $scopes );
	} );

	add_filter( 'wp_mail_smtp_pro_providers_outlook_mailer_api_url', function ( $url ) use ( $country_code ) {
		return str_replace( '', 'microsoft.' . $country_code, $url );
	} );

// Define country code as first parameter.
theme_prefix_enable_gcc_high_and_dod_compatibility( 'us' );

If you need to account for a domain extension with a different country code, such as .de, simply replace 'us' with your country code, in the last line of the code provided above. For example,

theme_prefix_enable_gcc_high_and_dod_compatibility( 'de' );

Note: For extra guidance, please see WPBeginner’s tutorial on adding custom code.

Will I need to reconnect if my login credentials have changed?

Yes, if you change your password, your connection will be invalidated. When this happens, you’ll need to reconnect WP Mail SMTP by going to WP Mail SMTP » Settings. Then scroll to the Authorization section and click Remove Connection.

remove connection button

Once you’ve removed the existing connection, you’ll need to click on Allow plugin to send emails using your Microsoft account to recreate your Microsoft 365 / mailer connection.


Does the Microsoft 365 / mailer support sending as a different user, shared inbox, or group?

Yes, the Microsoft 365 / mailer supports sending emails from different users, shared inboxes, and groups. These options can be configured in the authorized Microsoft account you’ve connected to WP Mail SMTP.

Below you’ll find relevant Microsoft documentation on how to configure these different sending options:

Once you set up any of these options, you can change the From Email address to any user’s email address that you’ve configured in your connected Microsoft account.

You’ll need to ask your Global Administrator to configure the admin consent workflow. Once this workflow is configured and you’ve been added as a reviewer, you’ll be able to request access to applications that require admin consent, such as WP Mail SMTP.

What if the test email doesn’t send successfully?

If the test email isn’t sending, you’ll likely see a debug log containing additional details about the issue. Here is a possible error message and how to resolve it.

Mailer: 365 / Outlook
ErrorSendAsDenied: The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message.

If you’re seeing the error message above, it means the From Email you specified differs from the email you used to authorize the connection. To fix this, you’ll need to update the From Email to match the one you authorized when setting up your Microsoft 365 / mailer connection.

If you’d like to use a different email as the From Email, you’ll need to add the email as an alias on your Microsoft account. For steps on this, please see the sending aliases section of this guide.

What should I do if I receive a MailboxNotEnabledForRESTAPI error?

The MailboxNotEnabledForRESTAPI error message is returned by Microsoft, indicating that the REST API, which is required for the Microsoft 365 / Outlook mailer, is not enabled on the Office 365 email account you’re attempting to authenticate. This error typically occurs when:

  • The Office 365 email account in use does not have REST API enabled.
  • The email account is hosted on a dedicated Microsoft Exchange Server rather than a valid Microsoft 365 mailbox.

To resolve this issue, ensure that you are using a valid Microsoft 365 mailbox and not an account on a dedicated Exchange Server. You can find more detailed information and assistance with enabling REST API in your mailbox by visiting Microsoft’s official documentation on this topic.

That’s it! You have successfully set up your site to send WordPress emails with the Microsoft 365 / mailer in WP Mail SMTP.

Next, would you also like to control which emails WordPress core sends out? Be sure to check out our tutorial on Email Controls for all the details.