> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pads4.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft

<Warning>
  This article requires you to have at least PADS4 version 2025.2.
</Warning>

This document provides step-by-step instructions for creating OAuth2 credentials for SMTP authentication using Google and Microsoft platforms. This document assumes the reader has basic familiarity with the Microsoft Azure Portal.

## **1. Register an application**

* Go to [https://portal.azure.com/](https://portal.azure.com/) and sign in with an account that has administrative privileges for Microsoft Entra ID
* In the left menu, select **App registrations**
* Configure the application:

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp1.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=f1e930848c12e4857ad2fb8e7290213a" alt="MS Smtp1" width="533" height="405" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp1.png" />

* Use the following information:
  * **Name:** Enter a descriptive name ( e.g. Gateway SMTP App )
  * **Supported account types:** Accounts in this organizational directory only
  * **Redirect URI:** The redirect URI specifies where the autorization server should send the user back after successfully authenticating to return an access token to their email account.
    * **Type**: Web
    * **URL:** http\://\<host>:\<port>/credentials/generic/authorize/callback
      * **Host**: DNS name or IP address of your PADS4 Web Portal
      * **Port:** Optional, if your PADS4 instance does not use the default ports for HTTP or HTTPS.
* Once the information has been filled in, click on "**Register**".
* Now on the app Overview page, copy the **Application(client) ID** and **Directory (tenant) ID**. These are required for your gateway configuration.

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp2.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=0f64a21066c35711ab876f2f2727b99c" alt="MS Smtp2" width="711" height="201" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp2.png" />

## **2. Create client secret**

* Go to **Certificates & secrets** > **Client Secrets** > **New client secret**.
* Add a description (e.g., "SMTP Secret") and select an expiration period (e.g., 24 months).
* Click**Add** , **then immediately copy** the **value** of the client secret. **Note**: **This value is only shown once**, and you will not be able to retrieve it after leaving this page. If you lose it, you'll need to generate a new one. This is your “**ClientSecret**”.
* Store it securely, as it grants access to your application

## **3. Configure API Permissions**

* From the left-hand navigation of your application's overview page, click on **API permissions > +Add** a permission
* Select Microsoft Graph

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp3.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=2effc7b8341c789470259d69dcb79ede" alt="MS Smtp3" width="632" height="320" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp3.png" />

* Choose Delegated **permissions > Search** for offline access

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smpt4.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=c1aa590d1eafd79b5fb39bce974cebaa" alt="MS Smpt4" width="1658" height="870" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smpt4.png" />

* Add **offline\_access** permission.

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp5.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=b1b1ba2be71814c02932cf46011c0c71" alt="MS Smtp5" width="2012" height="864" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp5.png" />

* Search for permission **SMTP.Send** and this permission as well.

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp6.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=09512a5e5899891b2f250113b608a17c" alt="MS Smtp6" width="2015" height="960" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp6.png" />

## **5. Configuration in PADS4**

To begin:

* Open your **web browser**.
* Navigate to the **PADS4 server URL** (either a DNS name or IP address).
* Log in using an **Administrator account**.

Once logged in:

* Click on **Dashboard**.
* Use the **Toggle Sidebar** button at the **top-left** of the screen.
* Navigate to **Credentials**.
* Then select **Providers**.
* Click on **New**

<img src="https://mintcdn.com/pads4/KYWdP9NvEcz9ns1X/images/ctrl-centre/administration/smtp-oauth2/SMTP-Oauth2White.png?fit=max&auto=format&n=KYWdP9NvEcz9ns1X&q=85&s=1425c7b6de06466da48fb987d9093f70" alt="SMTP Oauth2white" width="617" height="488" data-path="images/ctrl-centre/administration/smtp-oauth2/SMTP-Oauth2White.png" />

* Select **SMTPOAuth2**

<img src="https://mintcdn.com/pads4/Uk83PvJNcBJKcxsp/images/ctrl-centre/administration/smtp-oauth2/MS-smtp7.png?fit=max&auto=format&n=Uk83PvJNcBJKcxsp&q=85&s=f134943b6d1b9454fd9af3112eef8a56" alt="MS Smtp7" width="557" height="720" data-path="images/ctrl-centre/administration/smtp-oauth2/MS-smtp7.png" />

* Fill in the information as follows:
  * **App name:** Represent the name of your provider in PADS4 (can be any value)
  * **SMTP Provider:** Microsoft
  * **App (client) ID:** Application ID from Azure/Entra ID described at the end of step 1
  * **Client Secret:** Retrieved from Azure/Entra ID described at the end of step 1
  * **Tenant ID:** Directory ID from Azure/Entra ID described at the end of step 1
* Click on **create**
* Now go to the overview page and select the SMTP provider that you have just configured.
* Click connect, choose your user account and grant the request access.

## How to use this set up in the SMTP configuration.

Once logged in:

* Click on **Home**.
* Use the **Toggle Sidebar** button at the **top-left** of the screen.
* Navigate to **Config**.
* Then press **Edit**

<img src="https://mintcdn.com/pads4/vw4NTIWzbMxhQxAY/images/ctrl-centre/administration/config/smtp-oauth.png?fit=max&auto=format&n=vw4NTIWzbMxhQxAY&q=85&s=d62db0c4f027ffe4c86bf0ac8ed127c6" alt="Smtp Oauth" width="746" height="1090" data-path="images/ctrl-centre/administration/config/smtp-oauth.png" />

* Turn on **Use OAuth**
* Select your just configured OAuth provider and Username.
* Fill in the rest of your SMTP server and address details
* You can then test the connection at the bottom left which will return a green checkmark if the connection is properly configured.

<img src="https://mintcdn.com/pads4/vw4NTIWzbMxhQxAY/images/ctrl-centre/administration/config/smtp-test-connection.png?fit=max&auto=format&n=vw4NTIWzbMxhQxAY&q=85&s=739951a2c49ca62583d74150f5d5d54e" alt="Smtp Test Connection" width="753" height="94" data-path="images/ctrl-centre/administration/config/smtp-test-connection.png" />
