# 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="https://870194474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_kE41Rl4pOtwKfvvQq%2Fuploads%2FlEmMsZKr4R07qunf9g9Y%2FSMTP%20Image%201.png?alt=media&#x26;token=25421fb4-5c39-42da-8c2d-a2b70f0ad361" 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="https://870194474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_kE41Rl4pOtwKfvvQq%2Fuploads%2FXOmj9jiPJjG8f7Tfs3mj%2FSMTP%20Image%202.png?alt=media&#x26;token=f24b99b6-8353-45e5-9e71-407ae0d92734" 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="https://870194474-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_kE41Rl4pOtwKfvvQq%2Fuploads%2Fcrju6BJNogYjDHPYae3s%2FSMTP%20Image%205.png?alt=media&#x26;token=cf6f3e96-9e11-42d1-8a03-d5422e27cf91" 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
