# SMTP

> Set up an SMTP server, including OAuth2 for Microsoft Exchange, in the Any2Info No-code Platform.

Under **Platform → SMTP** you configure the mail server(s) the platform uses to send emails. This page describes how to set up OAuth2 authentication for Microsoft Exchange, which is the recommended way to connect to Exchange Online.

## Create an app registration on Azure

1. Sign in to the Azure portal and go to **App registrations**.
2. Select **New registration**.
3. Enter a name. This name is shown to users when they configure the SMTP server.
4. Choose the applicable supported account type.
5. Add a redirect URI in the following format: `https://{yourURL}/platform/shareddata/connectiontoken/`
6. Select **Register** to create the app registration.

## Edit the API permissions

1. In the Azure portal, go to **API permissions**.
2. Select **Add a permission**.
3. Select **Microsoft Graph**, then **Delegated permissions**.
4. Enable the following permissions:
   - `Email`
   - `Offline_access`
   - `SMTP.Send`

## Grant admin consent

1. On the **API permissions** tab, select **Grant admin consent for {tenant}**.
2. Confirm the admin consent.
3. Each permission should now show the status **Granted for {tenant}**.

## Gather the required values

To configure the SMTP server, you need:

- **Tenant ID**: found under **Overview** as "Directory (tenant) ID".
- **Client ID**: found under **Overview** as "Application (client) ID".
- **Client secret**: created under **Certificates & secrets**. Select **New client secret** to create one (we recommend an expiry of 24 months). Copy the secret value immediately, as it cannot be viewed again after you leave the page.

## Create a new SMTP server

1. Open the Any2Info platform and go to **Platform → SMTP**.
2. Select the **+** button to create a new SMTP server.
3. Choose the **Microsoft OAuth2** option.
4. Fill in the tenant ID, client ID, and client secret gathered above.
5. Select **Set token**, then sign in and accept the access request.
6. Select **Validate connection** to confirm the setup works.
7. Select **Save** to save the SMTP server.

## Send a test mail

Select the mail icon next to the SMTP server to send a test email and confirm it's working correctly.

## Configure settings to use the new server (optional)

Open **Settings** in the Any2Info platform, and for every mail-related setting, make sure the correct SMTP server is selected.