# Configuring Office 365 SMTP

{% hint style="info" %}
**Pre-requisites:**

* Inforiver installation is On-premises and the SMTP environment variable should be set to Office365 as shown in the image below.

<img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2F0NwKQZamuqPc3VD1asCk%2Fimage.png?alt=media&#x26;token=e8d143b3-03df-4374-91de-2c115621170c" alt="" data-size="original">

* You need to have admin privileges in Office 365 as well as be the workspace admin for Inforiver to configure these steps.
  {% endhint %}

Microsoft supports OAuth2.0 client credential flow for application permissions which allows us to authenticate to Azure AD without the need of having an authenticating user in the process. The authentication is entirely based on the tenant ID, client ID and client secret of an application (Inforiver).

Using GRAPH API authentication, Inforiver captures the required user tokens for sending emails.

### **Permissions required in Office 365**

Inforiver requires the following permissions to be granted in Office 365 as explained below.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FR6eu8mosR5DiU0aDlmjF%2Fimage.png?alt=media&#x26;token=1479c5d2-32ad-4a70-bc63-1270673e5d35" alt=""><figcaption><p><strong>Permissions required in Office 365 for Inforiver</strong></p></figcaption></figure>

**Mail.Send:** This permission is required to send emails which would be granted when the user configures the Office365 SMTP settings and provides consent.

**Mail.ReadWrite:** This additional permission is required to send large file attachments, which would be granted if the user enables the large file attachment settings.

Let us see the steps to configure the above settings.

### Steps to Configure MS Office 365 SMTP

1. Go to the Tenant Settings page by clicking on the **Settings** menu on the left side of the window. (**Note:** Only Workspace Admin has access to the Tenant Settings page of Inforiver).
2. Enter the required **From Email Address.** A mail box should be configured for the user or for the group that is specified in the From Email Address. (They should have a shared mail box access).

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FRrdZDdeIFCDJ1Qc0aoMX%2Fimage.png?alt=media&#x26;token=99015b96-9427-4f3b-bc68-1fbf99967981" alt=""><figcaption><p><strong>Tenant Settings Page</strong></p></figcaption></figure>

3. The email entered is form-validated by the app, after which the **Enable** button is enabled on the screen.&#x20;
4. Click **Enable**. This opens the Microsoft 365 consent screen where the user has to provide the consent. Admin privileges are required to provide consent.
5. After providing the consent, Inforiver is granted the **Mail.Send** permission.

{% hint style="info" %}
Since we have provided a pre-configured **From Email Address** in MS Office SMTP settings who is going to be the sole sender, **Enable Single Sender Identity** option will be greyed out and locked for toggle.
{% endhint %}

The tenant settings table will save the encrypted user tokens after a successful login.

### Reset MS office SMTP user tokens

1. Click **Reset** to reset the SMTP user tokens and settings.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FN1PEvEF6itJkpPalKkB9%2Fimage.png?alt=media&#x26;token=94a009df-4928-4c60-b448-bf075e721b4d" alt=""><figcaption><p><strong>Reset SMTP settings</strong></p></figcaption></figure>

2. After reset, the configured email address is removed. The user can then configure it again if required by following the above [steps](#steps-to-configure-ms-office-365-smtp).

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FAUajPQdmp581Pjc0rYdM%2Fimage.png?alt=media&#x26;token=02519cac-6ec8-48b0-ba01-1c3b8d733b7c" alt=""><figcaption><p><strong>From Email Address - Removed</strong></p></figcaption></figure>

### Update 'From Email Address' in MS office SMTP&#x20;

1. Go to the Tenant Settings page.
2. Reset SMTP user tokens as explained [above](#reset-ms-office-smtp-user-tokens).

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FN1PEvEF6itJkpPalKkB9%2Fimage.png?alt=media&#x26;token=94a009df-4928-4c60-b448-bf075e721b4d" alt=""><figcaption></figcaption></figure>

3. Enter the desired email ID in the **From Email Address** and provide the consent in the Microsoft 365 consent screen.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FAUajPQdmp581Pjc0rYdM%2Fimage.png?alt=media&#x26;token=02519cac-6ec8-48b0-ba01-1c3b8d733b7c" alt=""><figcaption><p><strong>Enter 'From Email Address'</strong></p></figcaption></figure>

4. The new Email Address (sender) is updated successfully.

### Update 'From Email Address' without Reset

You can update the **From Email Address** without resetting the SMTP settings as explained below:

1. Go to the Tenant Settings page.
2. Check if the Office SMTP is configured. If it is configured, please enter a valid **From Email Address** that is to be updated.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FrU2kQTsNCvSX0liSbtFM%2FUpdate%20From%20Email%20Address.png?alt=media&#x26;token=1e45239d-d09f-411e-8222-fd837334105f" alt=""><figcaption><p><strong>Update 'From Email Address'</strong></p></figcaption></figure>

3. Click **Save** button.&#x20;
4. This opens the consent popup screen.
5. After providing the consent, the new **From Email address** is updated.

### Steps to Enable Large File Attachments in MS office SMTP

1. To enable large file attachments, toggle the button **Enable large file attachments** and click **Save.**

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FTtnWCqC2kaYNAS3nVBSN%2Fimage.png?alt=media&#x26;token=99a706c9-4f52-460c-8580-e169c740c32b" alt=""><figcaption><p><strong>Enable large file attachments</strong></p></figcaption></figure>

{% hint style="info" %}
**Note:** If the **From Email Address** is not configured already, please configure it by following the steps listed [here](#steps-to-configure-ms-office-365-smtp). While configuring, you can toggle the large attachments button before clicking **Enable.**
{% endhint %}

2. After clicking **Save** (or **Enable,** in case you're configuring the email now) the consent screen appears.
3. By providing the consent, Inforiver is granted both the **Mail.Send** and **Mail.ReadWrite** permissions.

The tenant settings table will save the user tokens (encrypted) after a successful login.

{% hint style="info" %}
**Note:** The toggle button to enable/disable large file attachments is locked and greyed out after authorizing it.

The acquired tokens can be deleted by a [Reset](#reset-ms-office-smtp-user-tokens) and then you can disable the large file attachments if required.
{% endhint %}

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2F3OR2lgLv8biYM5zmZEbq%2Fimage.png?alt=media&#x26;token=a4a1694b-cfdf-493b-978d-2e3d7be307ba" alt=""><figcaption><p><strong>large file attachments toggle is greyed out</strong></p></figcaption></figure>

### Delegated mail box

You can create an empty group email and delegate the complete access of the group email to any org email user using the **Send As** permission. This configuration needs to be done in the portal for groups.

Once configured, the **From Email Address** will be the group email ID of the empty distribution list.

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2FUEy0T0mexqcfuyhtqeGw%2Fimage.png?alt=media&#x26;token=10b5b203-cc03-4eb3-83df-9e05bf170fb2" alt=""><figcaption><p><strong>Group Email ID in From Email Address</strong></p></figcaption></figure>

But internally, it uses the graph access tokens of the delegated user.&#x20;

{% hint style="info" %}
**Note:** The delegated user should have configured the SMTP settings and provided consent.
{% endhint %}

<figure><img src="https://4102771481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftn9fmavAcyzaE7MAMP2U%2Fuploads%2F3WYgydPBtegPDoTNtIxt%2FProvide%20Consent%20to%20Inforiver.png?alt=media&#x26;token=d3b457e7-b8b3-4ead-859d-229fba2635ac" alt=""><figcaption><p><strong>Provide Consent for Inforiver</strong></p></figcaption></figure>

{% hint style="info" %}
Please restart the ACI/AKS instances so that the backend can fetch the new environment variable changes.
{% endhint %}
