How to Set Up the Microsoft 365 / Outlook.com Mailer in WP Mail SMTP

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

In this tutorial, we’ll show you every step needed to set up the Microsoft 365 / Outlook.com mailer in WP Mail SMTP.

Requirements:

  • 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 / Outlook.com mailer is only available with the Pro license or higher.


What is the Microsoft 365 / Outlook.com 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). 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.

Note: If you would like to know more about other mailers that you can use, check out our complete guide to WP Mail SMTP mailers.

If this mailer sounds like a good fit for your site, then let’s get started!

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.

settings-page

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

Mailer

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 / Outlook.com 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 brand new account, you can 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 that includes 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: yourdomain.com”.
  • 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.

Click-register-button

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.

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, skip down to the Client secrets section. Then, select + New client secret.

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: 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 section, and head back over to your WP Mail SMTP settings.

Copy client secret from Microsoft account

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

Application-password

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.

click-to-confirm-auth

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.

authorization-email

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

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.

from-email-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.

From Name

The Microsoft 365 / Outlook.com 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.

Microsoft-from-name

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.

wpmailsmtp-email-test

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. Then, click the Send Email button.

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 / Outlook.com 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 / Outlook.com 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.com', '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.com', '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.com', '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.com', '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.com', '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. You will need to reestablish your connection with the new password, in order to continue.

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

Yes, the Microsoft 365 / Outlook.com 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.

That’s it! You have successfully set up your site to send WordPress emails with the Microsoft 365 / Outlook.com 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.