> For the complete documentation index, see [llms.txt](https://docs.enginsight.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enginsight.com/docs/manual/english/archive/mail-server-configuration.md). Agents can also search and read this documentation through its [MCP server](https://docs.enginsight.com/docs/~gitbook/mcp).

# Mail Server Configuration

To receive email notifications when an alert is triggered in the Enginsight platform, you must configure your email server in the Enginsight configuration. In the following, we will show you what steps you need to take.

***

## Configuring the Email Server

{% hint style="warning" %}
**Please note:** The following steps must be taken *on the Enginsight Application Server*. If you are using a [load-balanced setup](https://docs.enginsight.com/docs/manual/english/installation-and-configuration/installation-and-configuration/load-balanced-setup.md), you must also configure the email server on the virtual machine that hosts the [Enginsight Services](https://docs.enginsight.com/docs/manual/english/installation-and-configuration/installation-and-configuration/load-balanced-setup/server-for-the-enginsight-services.md).
{% endhint %}

{% stepper %}
{% step %}
Log in to the Enginsight Application Server if you have not already done so.

You can do this either directly through the console of your Application Server VM or remotely via SSH (Secure Shell) from a different machine.
{% endstep %}

{% step %}
Open the Enginsight configuration file using the following command:

```
sudo nano /opt/enginsight/enterprise/conf/services/config.json
```

Press **Enter** to confirm your input.
{% endstep %}

{% step %}
Navigate to the `email` section and adjust it as follows

<pre><code>"email": {
<strong>    "sender": "'&#x3C;CompanyName>' &#x3C;SenderEmailAddress>",
</strong><strong>    "host": "&#x3C;MailServerHostname>",
</strong><strong>    "port": "&#x3C;MailServerPort>",
</strong>    "sslTls": true,
<strong>    "user": "&#x3C;MailServerUsername>",
</strong><strong>    "pass": "&#x3C;MailServerPassword>",
</strong>    "maxConnections": 5,
    "rateDelta": 1000,
    "rateLimit": 5
  },
</code></pre>

{% hint style="info" %}
Remember to replace the following placeholders in <> accordingly:

* `<CompanyName>`
* `<SenderEmailAddress>`
* `<MailServerHostname>`
* `<MailServerPort>`
* `<MailServerUsername>`
* `<MailServerPassword>`
  {% endhint %}

{% hint style="danger" %}
**Please note:** If you have configured an SPF (Sender Policy Framework) record in your DNS, specifying a sender address is mandatory.
{% endhint %}

{% hint style="warning" %}
**Please note**: In some cases, a different email server configuration may be required. Example configurations can be found in the section [Alternative configurations](#alternative-configurations).
{% endhint %}
{% endstep %}

{% step %}
Save the changes to the configuration file (**Ctrl** + **o**) and confirm the save process. Close the file (**Ctrl** + **x**).
{% endstep %}

{% step %}
You must now run the Application Server setup script again to apply your changes.

Navigate to the Enginsight installation directory using the following command:

```
cd /opt/enginsight/enterprise
```

Press **Enter** to confirm your input.
{% endstep %}

{% step %}
Run the setup script anew using the following command and confirm all prompts by pressing **Enter**:

```
sudo ./setup.sh
```

{% endstep %}
{% endstepper %}

### Alternative Configurations

In some environments, the email server requires a configuration that differs from the default settings. The following examples show configurations for a [Microsoft 365 email server](#example-configuration-for-a-microsoft-365-mail-server), an on-premises [Microsoft Exchange server](#example-configuration-for-an-on-premises-exchange-server), and a [email server without TLS](#example-configuration-for-a-mail-server-without-tls).

#### Example Configuration for a Microsoft 365 Email Server

{% hint style="info" %}
Remember to replace the following placeholders in `<>` accordingly:

* `<CompanyName>`
* `<SenderEmailAddress>`
* `<MailServerUsername>`
* `<MailServerPassword>`
  {% endhint %}

<pre><code>"email":{
<strong>  "sender": "'&#x3C;CompanyName>' &#x3C;SenderEmailAddress>",
</strong>  "unqueued": true,
  "host": "smtp.office365.com",
  "requireTLS": false, 
  "ignoreTLS": false, 
  "rejectUnauthorized": false, 
  "secure": false, 
  "sslTls": false,
  "port": 587,
<strong>  "user": "&#x3C;MailServerUsername>",
</strong><strong>  "pass": "&#x3C;MailServerPassword>",
</strong>  "maxConnections": 5,
  "rateDelta": 1000,
  "rateLimit": 5,
  "service": "Outlook365"
}, 
</code></pre>

#### Example Configuration for an On-Premises Microsoft Exchange Server

{% hint style="info" %}
Remember to replace the following placeholders in `<>` accordingly:

* `<CompanyName>`
* `<SenderEmailAddress>`
* `<MailServerHostname>`
* `<MailServerUsername>`
* `<MailServerPassword>`
  {% endhint %}

<pre><code>"email":{
<strong>  "sender": "'&#x3C;CompanyName>' &#x3C;SenderEmailAddress>",
</strong>  "unqueued": true,
<strong>  "host": "&#x3C;MailServerHostname>",
</strong>  "requireTLS": false, 
  "ignoreTLS": false, 
  "rejectUnauthorized": false, 
  "secure": false, 
  "sslTls": false,
  "port": 587,
<strong>  "user": "&#x3C;MailServerUsername>",
</strong><strong>  "pass": "&#x3C;MailServerPassword>",
</strong>  "maxConnections": 5,
  "rateDelta": 1000,
  "rateLimit": 5
}, 
</code></pre>

#### Example Configuration for a Email Server Without TLS

{% hint style="info" %}
Do not forget to replace the following placeholders in `<>` accordingly:

* `<CompanyName>`
* `<SenderEmailAddress>`
* `<MailServerHostname>`
* `<MailServerUsername>`
* `<MailServerPassword>`
  {% endhint %}

<pre><code>"email":{
<strong>  "sender": "'&#x3C;CompanyName>' &#x3C;SenderEmailAddress>",
</strong>  "unqueued": true,
<strong>  "host": "&#x3C;MailServerHostname>",
</strong>  "requireTLS": false, 
  "ignoreTLS": true, 
  "rejectUnauthorized": false, 
  "secure": false, 
  "sslTls": false,
<strong>  "user": "&#x3C;MailServerUsername>",
</strong><strong>  "pass": "&#x3C;MailServerPassword>",
</strong>  "maxConnections": 5,
  "rateDelta": 1000,
  "rateLimit": 5
},
</code></pre>

***

## Testing the Email Server Configuration

After configuring the email server, you can check the configuration from the Application Server console.

Follow these steps:

{% stepper %}
{% step %}
Use the following command to obtain the ID of the Sentinel Docker container that is installed on the Application Server:

```
sudo docker ps --filter "name=sentinel" --format "{{.ID}}"
```

Press **Enter** to confirm your input.

{% hint style="danger" %}
**Please note**: This step is **mandatory** since all container IDs are created anew when you run the setup script for the Application Server again!
{% endhint %}
{% endstep %}

{% step %}
Use the following command to send a test email and press **Enter** to confirm your input:

```
sudo docker exec <SentinelContainerID> ./sendTestMail --to <RecipientEmailAddress>
```

{% hint style="info" %}
Remember to replace `<SentinelContainerID>` and `<RecipientEmailAddress>` accordingly.
{% endhint %}
{% endstep %}

{% step %}
If the configuration is correct, the following message will be displayed in the console.

<figure><img src="https://content.gitbook.com/content/V7OrHgKXA0t1jankQBYf/blobs/L6Vm0u6fO9xdob5UMMny/Enginsight-Mailserverkonfiguration-erfolgreich.jpg" alt=""><figcaption></figcaption></figure>

You should also receive a test email at the specified recipient email address.
{% endstep %}
{% endstepper %}

***
