# How to setup Mailbox access

Source: https://help.sendent.com/nextcloud-for-email/nextcloud-for-outlook-cross-platform/how-to-setup-mailbox-access

Depending on how you deploy the Sendent for Outlook (cross-platform) solution, it requires mailbox access in a specific manner.

The guide distinguishes between Microsoft 365 Exchange and Exchange On-Premise deployments.

The settings that will be adjusted specifically affect the Docker Compose configuration.



By default, Sendent uses the legacy Exchange authentication, however, this may break in the future once Microsoft decides to disable it for Microsoft 365. For Exchange On-Premise configuration, scroll down to the very end or use the menu on the right.

### Microsoft 365 

In case you're deploying Sendent for Outlook against your Microsoft 365 mailbox, apply the following steps.

#### Step 1. Create a new app-registration

1. Access your Microsoft entra-environment at <https://portal.azure.com>.
2. From here navigate to 'App registration'.
3. Register a new app registration with the following settings.

| **Name** | **Value** | **Description** |
|---|---|---|
| Name | sendent-outlook | The app registration can be named anything; just make sure it's something easily identifiable for your reference. |
| Supported Account Types | Single tenant | Sendent for Outlook only supports Single tenant application access. |

If you have already created an app registration for Sendent for Outlook and are using the `MS_AUTH_TYPE=naa` environmental variable, you can migrate to the M365 authentication flow by following [this article](https://help.sendent.com/sendent-for-outlook-cross-platform/migrate-m365-authentication-flow).



**Overview**

![image.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770381624_6985e1384f038.png)

#### Step 2. Configure redirect URI

Once the app registrations has been created, you will be automatically redirected to the app registration details. Once there, navigate to the **Manage/Authentication** tab on the side menu:

![image.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770381840_6985e210ba834.png)

After navigating to the **Authentication** tab, you might be met with the “New experience” offered by Azure for app registrations. For a consistent set up, you should switch to the **old experience** (this can be reverted later):

![Group 7.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770382467_6985e4832cd98.png)

Now, under **Platform Configurations**, click **Add a platform** and select **Single-page application**.

![Group 8.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770382551_6985e4d7420df.png)

You should be met with the **Configure single-page application** page. Here, fill in the **Redirect URI** field with the value `brk-multihub://{YOUR_HOST_DOMAIN}` and then click configure:

![Group 9.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770382722_6985e582f3af9.png)

#### Step 3. Setting up permissions

After setting up the redirect URI for your host, navigate to the **API permissions** tab. Here, Sendent for Outlook must be given delegated API permissions.

1. Navigate to `API permissions` in the menu.
2. Click `Add a permission`.
    
    ![](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/mceclip1_1733908133.png)
3. Choose `Microsoft Graph` on the menu that pops up.
    
    ![Group 10.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770382884_6985e624b91b7.png)
4. You will be presented the option to choose either 'Delegated permissions' or 'Application permissions'. Here we choose for `Delegated permissions`.
    
    ![Group 11.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770382948_6985e664244fd.png)
5. Now you can search for delegated permissions. You should add the following permissions and then click **Add permissions**:
    
    | Permission |
    |---|
    | `Mail.ReadWrite` |
    | `Mail.Send` |
    | `User.Read` |
    | `profile` |
    | `openid` |
    | `email` |
    | `offline_access` |

The overview should now look as follows:

![image.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770383223_6985e777a7a74.png)

The last step is to **Grant admin consent** for your organization by clicking the respective button.

![Group 12.png](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/1770383292_6985e7bc482c5.png)

#### Step 4. Copying information

Within the app-registration, access the overview menu.

Once there, copy the `Application (client) ID` and `Directory (tenant) ID` values to some notepad. You will need these values to set up mailbox authentication.

![](https://cdn.eniston.com/bases/0f220f4b-6749-49a9-8420-4a32e6d205f7/attachments/mceclip7_1733908873.png)

#### Step 5. Modifying docker compose

Set the following environment variables within your docker compose file.

| **Environment Settings** | **Value** | **Description** |
|---|---|---|
| MS\_AUTH\_TYPE | naa\_silent | Should always be set to `naa_silent`. |
| MS\_APP\_ID | &lt;app\_registration\_id&gt; | The `Application (client) ID` of your app registration. |
| MS\_TENANT\_ID | &lt;tenant\_id&gt; | The `Directory (tenant) ID` of your app registration. |

**Example**

```yaml
version: '3.9'

services:
  sendent.outlook:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-outlook:latest
    build:
      context: .
      dockerfile: Dockerfile
    restart: on-failure
    environment:
     - MS_AUTH_TYPE=naa_silent
     - MS_APP_ID=<app_registration_id>
     - MS_TENANT_ID=<tenant_id>
     - BASE_URL=<your_base_url>   # e.g., outlook.sendent.com
    ports:
      - 4300:4300
    volumes:
      - ./docker-config:/usr/src/app/outlook-addin/docker-config
    networks:
      - node_network

networks:
  node_network:

```

### Exchange On-Premise

In case you're deploying Sendent for Outlook against Exchange On-Premise, apply this step.

Ensure to add the following environment variable is set in your docker compose file:

`MS_AUTH_TYPE=legacy_exchange`

**Example:**

```yaml
version: '3.9'

services:
  sendent.outlook:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-outlook:latest
    build:
      context: .
      dockerfile: Dockerfile
    restart: on-failure
    environment:
     - MS_AUTH_TYPE=legacy_exchange
     - BASE_URL=https://outlook.sendent.com
    ports:
      - 4300:4300
    volumes:
      - ./docker-config:/usr/src/app/outlook-addin/docker-config
    networks:
      - node_network

networks:
  node_network:

```
