# SMTP

## Create app registration on Azure

* Sign into the azure portal and go to app registrations&#x20;
* Click on "New registration"
* Enter a name, this name wil be shown to the users when configuring the SMTP server&#x20;
* Choose the applicable supported account type&#x20;
* Add a redirect URI with the following format:
  * https\://{yourURL}/platform/shareddata/connectiontoken/&#x20;
* Create the registration

## Edit the API permissions

* On de azure portal go to the API permissions menu item&#x20;
* Select “Add a permission”&#x20;
* Select the “Microsoft Graph” option&#x20;
* Select the “Delegated permissions” option&#x20;
* Check the options:&#x20;
  * Email&#x20;
  * Offline\_access&#x20;
  * SMTP.Send&#x20;
* The completed permissions should look like the image below:

<div align="left"><figure><img src="/files/UWe7JPQZwglEQUSswdDg" alt=""><figcaption></figcaption></figure></div>

## Grant admin consent

* In the API permissions tab click on the button “Grant admin consent for xxxxx”&#x20;
* Confirm the admin consent
* After completing this step the permissions should show the status “Granted for xxxxx”

<div align="left"><figure><img src="/files/kpILkcHB55VP1oG1vsE4" alt=""><figcaption></figcaption></figure></div>

## Gather the needed values

* To configure the SMTP server we need the following values:
  * TenantId, can be found in the overview menu item of the app registration "*Directory (tenant) ID*"
  * ClientId, can also be found on the overview menu item "*Application (tenant) ID*"
  * Client secret, can be created in the "*Certificates & Secrets*" menu item
    * After opening the menu item click “New client secret” and create a secret (we recommend setting the expire time to 24 months)&#x20;
    * Make sure to copy the secret value this cannot be viewed after leaving the page

## Create a new SMTP server

* Open the Any2Info platform&#x20;
* Go to Platform -> SMTP&#x20;
* Select the "Plus button" to create a new SMTP server&#x20;
* Choose for the option “Microsoft OAuth2”&#x20;
* Fill the values as shown on the image below&#x20;
* After all the fields are filled press the button “Set token”&#x20;
* Sign in and accept the access request&#x20;
* Press the validate connection button&#x20;
* To save the settings press the save button

<div align="left"><figure><img src="/files/bgd9GeVMiM6dSGpMmwUy" alt=""><figcaption></figcaption></figure></div>

## Send a test mail

* To test the new SMTP server press the "Mail icon" and send a test email

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

* In the Any2Info platform open the settings menu option&#x20;
* For all the mail settings make sure the correct SMTP server is set


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.any2info.com/any2info-academy/no-code-platform/platform/smtp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
