Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

Sending/Receiving Emails Using Microsoft 365 With Regular User & Service Account

Sending Emails Using Microsoft 365 With Regular User Account

This method doesn’t require Admin consent to be set.

Step 1

Open web.config and add (or update) following key / values:

  • <add key="Mail.Sending.ServerType" value="Microsoft365" />
  • <add key="Mail.Sending.Microsoft365.IntegrationType" Value="Public" />

Step 2

Navigate to azure portal (https://portal.azure.com/) and open Azure Active Directory > Overview.

clipboard_ee429b41e40d0e04bbe0fa05bfcd77f00.png

Copy TenantID value and paste it into the following key (as value):

  • <add key="Mail.Sending.Microsoft365.PublicApp.TenantId" value="copied_tenant_id" />

Step 3

Navigate to App registration and register using 'New registration' or use one of existing registered app.

clipboard_e1f31612fa0a1f42d4555cdf76442b786.png

For new application select suitable 'Supported account types' and as Redirect URI please select 'Public client/native (mobile & desktop)'. Once application is registered open its page. Copy 'Application (client) ID' (value) and paste into the following web.config key:

  • <add key="Mail.Sending.Microsoft365.PublicApp.ClientId" value="client_id" />

clipboard_e01589fb68b01dfede8bfe740e9567d5e.png

Step 4

Navigate to Authentication tab. Find 'Redirect URI' for native client. Copy its value and paste it into the following web.config key:

  • <add key="Mail.Sending.Microsoft365.PublicApp.RedirectUri" value="native_client_uri" />

clipboard_ea6c51cae42c09827dc3b88416a9641c2.png

Step 5

Navigate to back to Azure Active Directory page. Open Users page and create a user that can be used by CMO application (or use any existing suitable user). 

clipboard_e81bd8a0b9672194172d93b632198f2a9.png

Copy 'User Principal Name' and paste its value into the following web.config key:

  • <add key="Mail.Sending.Microsoft365.PublicApp.AccountName" value="user_principal_name" />

clipboard_e7768de38e3e0bfc2c46516b86f9bd426.png

Step 6

Navigate to 'API Permissions' and add following Microsoft.Graph permissions (note, all permissions must be 'Delegated'):

  • Mail.Read
  • Mail.ReadWrite
  • Mail.Send
  • Offline_access

clipboard_e97fec3a1a3d5e8c0803de4c7dd66e3f4.png

Step 7

Login to the hosted Web.App server (in case of setup: ‘multiple web servers – one db’ repeat this step for every web server or at least for web servers that are used by CMO Scheduler).

Find 'CMO.Microsoft365TokenHelper' (current version is 1.0.1, the tool is available in packages folder) tool. The tool has following options:

  • <add key="ClientId" value=""/>
  • <add key="TenantId" value=""/>
  • <add key="RedirectUri" value=""/>
  • <add key="CacheFileName" value=""/>
  • <add key="CacheDirectory" value=""/>

ClientId , TenantId,  RedirectUri must have exactly the same values used in previous steps.

The tool should generate a file with saved OAuth token for a user specified in Step 5. This token will be used by CMO Application for authorization. CacheFileName is a name of file to be generated with token (default name is cmo_msal_cache.dat). CacheDirectory is a directory where the file will be generated (note, the user who run the tool must have access to the CacheDirectory, i.e. should be able to create file in that directory). Default value is MSAL_CACHE. Run the tool in Windows Terminal / CMD, Power Shell. The tool should open an standard MS Authorization window. In that window, please enter credential for the user from the Step 5.

Step 8

Open web.config and add (or modify) following keys:

  • <add key="MSAL.Cache.Folder" value="" />
  • <add key="MSAL.Cache.FileName" value="" />

MSAL.Cache.FileName should be a name of file with token generated in Step 7. MSAL.Cache.FileName  should be a directory name accessible for the IIS user. Now copy file generated in Step 7 to folder specified in MSAL.Cache.Folder.

 

Receiving Emails Using Microsoft 365 With Regular User Account

This method doesn’t require Admin consent to be set.

Step 1

Open web.config and add (or update) following key / values:

  • <add key="Mail.Receiving.ServerType" value="Microsoft365" />
  • <add key="Mail.Receiving.Microsoft365.IntegrationType" Value="Public" />

Step 2

Navigate to azure portal (https://portal.azure.com/) and open Azure Active Directory > Overview.

clipboard_ec6e6d96d4343598797b328887d0459f8.png

Copy TenantID (highlighted on the screenshot above) value and paste it into the following key (as value):

  • <add key="Mail.Receiving.Microsoft365.PublicApp.TenantId" value="copied_tenant_id" />

Step 3

Navigate to App registration and register using 'New registration' or use one of existing registered app.

clipboard_ed2c2b79ccc3cfae9aae85a82b08935ae.png

For new application select suitable 'Supported account types' and as Redirect URI please select 'Public client/native (mobile & desktop)'. Once application is registered open its page. Copy 'Application (client) ID' (value) and paste into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.PublicApp.ClientId" value="client_id" />

clipboard_ea67bbf9961c5f92b7b711d88c97558ac.png

Step 4

Navigate to Authentication tab. Find 'Redirect URI' for native client. Copy its value and paste it into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.PublicApp.RedirectUri" value="native_client_uri" />

clipboard_e65698964e6e0716bd050166c553d13f7.png

Step 5

Navigate to back to Azure Active Directory page. Open Users page and create a user that can be used by CMO application (or use any existing suitable user).

clipboard_e3c4e15293c36b058acb106ff899c1a1e.png

Copy 'User Principal Name' and paste its value into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.PublicApp.AccountName" value=" principal_name" />

clipboard_e7d976deacc07fca11a1ad9e853f4fa34.png

Step 6

Navigate to 'API Permissions' and add following Microsoft.Graph permissions (note, all permissions must be 'Delegated'):

  • Mail.Read
  • Mail.ReadWrite
  • Mail.Send
  • Offline_access

clipboard_e11ec2d76eb20de7c86e7705884022e15.png

Step 7

Login to the Server where Web.App is hosted (in case of setup: ‘multiple web servers – one db’ repeat this step for every web server or at least for web servers that are used by CMO Scheduler).

Find 'CMO.Microsoft365TokenHelper' (current version is 1.0.1, the tool is available in packages folder) tool. The tool has following options:

  • <add key="ClientId" value=""/>
  • <add key="TenantId" value=""/>
  • <add key="RedirectUri" value=""/>
  • <add key="CacheFileName" value=""/>
  • <add key="CacheDirectory" value=""/>

ClientId , TenantId,  RedirectUri must have exactly the same values used in previous steps.

The tool should generate a file with saved OAuth token for a user specified in Step 5. This token will be used by CMO Application for authorization. CacheFileName is a name of file to be generated with token (default name is cmo_msal_cache.dat). CacheDirectory is a directory where the file will be generated (note, the user who run the tool must have access to the CacheDirectory, i.e. should be able to create file in that directory). Default value is MSAL_CACHE. Run the tool in Windows Terminal / CMD, Power Shell. The tool should open a standard MS Authorization window. In that window, please enter credential for the user from the Step 5.

Step 8

Open web.config and add (or modify) following keys:

  • <add key="MSAL.Cache.Folder" value="" />
  • <add key="MSAL.Cache.FileName" value="" />

MSAL.Cache.FileName should be a name of file with token generated in Step 7. MSAL.Cache.FileName  should be a directory name accessible for the IIS user. Now copy file generated in Step 7 to folder specified in MSAL.Cache.Folder.

 

Sending Emails Using Microsoft 365 With Service Account

This method requires Admin consent to be set.

Step 1

Open web.config and add (or update) following key / values:

  • <add key="Mail.Sending.ServerType" value="Microsoft365" />
  • <add key="Mail.Sending.Microsoft365.IntegrationType" Value="Confidential" />

Step 2

Navigate to azure portal (https://portal.azure.com/) and open Azure Active Directory > Overview.

clipboard_e76bd7a61fdc6fb754ef6550269d64d01.png

Copy TenantID (highlighted on the screenshot above) value and paste it into the following key (as value):

  • <add key="Mail.Sending.Microsoft365.ConfidentialApp.TenantId" value="copied_tenant_id" />

Step 3

Navigate to App registration and register using 'New registration' or use one of existing registered app.

clipboard_e5e46319239bf7393af34e45badadebe7.png

For new application select suitable 'Supported account types' and as Redirect URI please select 'Public client/native (mobile & desktop)'. Once application is registered open its page. Copy 'Application (client) ID' (value) and paste into the following web.config key

  • <add key="Mail.Sending.Microsoft365.ConfidentialApp.ClientId" value="client_id" />

clipboard_eba89be696d3e9b79eb620fcf965c06d5.png

Step 4

Navigate to back to Azure Active Directory page. Open Users page and create a user that can be used by CMO application (or use any existing suitable user).

clipboard_e010e6078cb60eacf7bf64d057a326c65.png

Copy 'Object ID' and paste its value into the following web.config key:

  • <add key="Mail.Sending.Microsoft365.ConfidentialApp.UserObjectId" value="object_id " />

clipboard_ed901a395689af10473354dea9f7eb4d2.png

Step 5

Navigate to 'Certificates & secrets' > Client Secrets. Create new secret. Copy its value and paste into the following web.config key:

  • <add key="Mail.Sending.Microsoft365.ConfidentialApp.Secret" value="secret" />

clipboard_ec25f0eac46e93ecfdffba5833ee1d5fc.png

Step 6

Navigate to 'API Permissions' and add following Microsoft.Graph permissions (note, all permissions must be Application):

  • Mail.Read
  • Mail.ReadWrite
  • Mail.Send

Confirm Admin consent for all permissions.

clipboard_e41a424a4e4807ecf48d5be3a604176b3.png

 

Receiving Emails Using Microsoft 365 With Service Account

This method requires Admin consent to be set.

Step 1

Open web.config and add (or update) following key / values:

  • <add key="Mail.Receiving.ServerType" value="Microsoft365" />
  • <add key="Mail.Receiving.Microsoft365.IntegrationType" Value="Confidential" />

Step 2

Navigate to azure portal (https://portal.azure.com/) and open Azure Active Directory > Overview.

clipboard_e4609e4e3fc793d765cc6dcc6bad604cf.png

Copy TenantID (highlighted on the screenshot above) value and paste it into the following key (as value):

  • <add key="Mail.Receiving.Microsoft365.ConfidentialApp.TenantId" value="copied_tenant_id" />

Step 3

Navigate to App registration and register using 'New registration' or use one of existing registered app.

clipboard_e3bccd74c4ad126e98069664e207c5fd2.png

For new application select suitable 'Supported account types' and as Redirect URI please select 'Public client/native (mobile & desktop)'. Once application is registered open its page. Copy 'Application (client) ID' (value) and paste into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.ConfidentialApp.ClientId" value="client_id" />

clipboard_e44a751493e0094f804a3e589421fd61e.png

Step 4

Navigate to back to Azure Active Directory page. Open Users page and create a user that can be used by CMO application (or use any existing suitable user). 

clipboard_e0f179c5b66de4a778456c64a258da659.png

Copy 'Object ID' and paste its value into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.ConfidentialApp.UserObjectId" value="object_id " />

clipboard_e4f28fa94e3ac1f93282e20402f52248c.png

Step 5

Navigate to 'Certificates & secrets' > Client Secrets. Create new secret. Copy its value and paste into the following web.config key:

  • <add key="Mail.Receiving.Microsoft365.ConfidentialApp.Secret" value="secret" />

clipboard_e6bff8e8029d43999234ff93582edfdfa.png

Step 6

Navigate to 'API Permissions' and add following Microsoft.Graph permissions (note, all permissions must be Application):

  • Mail.Read
  • Mail.ReadWrite
  • Mail.Send

Confirm Admin consent for all permissions.

clipboard_e8d7cd278250098eb7f1d6e5eecc57444.png

 

Receiving New Action Emails

Configuration steps the same as for ‘Receiving emails using Microsoft 365 with regular user account’ and ‘Receiving emails using Microsoft 365 with service account’. The difference is only in a web.config key prefix. Instead of Mail.Receiving Mail.NewAction.EmailClient should be used., e.g.

Instead of:

  • Mail.Receiving.Microsoft365.ConfidentialApp.ClientId

use:

  • Mail.NewAction.EmailClient.Microsoft365.PublicApp.ClientId

and so on.

Receiving Document Import Emails

Configuration steps the same as for ‘Receiving emails using Microsoft 365 with regular user account’ and ‘Receiving emails using Microsoft 365 with service account’. The difference is only in a web.config key prefix. Instead of Mail.Receiving Mail.DocumentImport.EmailClient should be used., e.g.

Instead of:

  • Mail.Receiving.Microsoft365.ConfidentialApp.ClientId

use:

  • Mail.DocumentImport.EmailClient.Microsoft365.PublicApp.ClientId

and so on.

  • Was this article helpful?