How to setup OAuth2 for Microsoft Exchange

Create app registration on Azure

  • Sign into the azure portal and go to app registrations

  • Click on "New registration"

  • Enter a name, this name wil be shown to the users when configuring the SMTP server

  • Choose the applicable supported account type

  • Add a redirect URI with the following format:

    • https://{yourURL}/platform/shareddata/connectiontoken/

  • Create the registration

Edit the API permissions

  • On de azure portal go to the API permissions menu item

  • Select “Add a permission”

  • Select the “Microsoft Graph” option

  • Select the “Delegated permissions” option

  • Check the options:

    • Email

    • Offline_access

    • SMTP.Send

  • The completed permissions should look like the image below:

  • In the API permissions tab click on the button “Grant admin consent for xxxxx”

  • Confirm the admin consent

  • After completing this step the permissions should show the status “Granted for xxxxx”

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)

      • Make sure to copy the secret value this cannot be viewed after leaving the page

Create a new SMTP server

  • Open the Any2Info platform

  • Go to Platform -> SMTP

  • Select the "Plus button" to create a new SMTP server

  • Choose for the option “Microsoft OAuth2”

  • Fill the values as shown on the image below

  • After all the fields are filled press the button “Set token”

  • Sign in and accept the access request

  • Press the validate connection button

  • To save the settings press the save button

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

  • For all the mail settings make sure the correct SMTP server is set

Last updated