> For the complete documentation index, see [llms.txt](https://docs.elimity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elimity.com/reference-manual/v3.44.2/installation/mail-server.md).

# Mail server

Elimity Insights servers send out emails for multiple reasons:

* to invite new user accounts
* to update subscribed users when stored query results change
* to warn subscribed connector admins when imports fail
* to request access reviews

For SaaS customers we perform the setup and maintenance of mail servers behind the scenes. These installation instructions are mainly useful for on-prem deployments.

From an Elimity Insights server's point of view, the only requirement is an SMTP server to accept the outgoing emails. In practice this means you can probably just use a mail server that is already available in your organization. We currently support the following authentication options:

* None: Elimity Insights will simply send mails to your SMTP server without prior authentication.
* Direct: Elimity Insights will try a variety of 'direct' SMTP authentication options (e.g. `PLAIN`, `LOGIN`, `CRAM-MD5`, ...) using a configured username and password.
* OAuth2: Elimity Insights will exchange configured client credentials for an access token and use it together with a configured username for `XOAUTH2` authentication at your SMTP server.

For example, many of our customers use Exchange Online as their mail server for Elimity Insights. Setting this up correctly is not easy though, so we highly recommend carefully reading through [the official documentation from Microsoft](https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth). Some points that require extra attention:

* the OAuth2 token URL should have the following format: `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token`
* the OAuth2 scope should be `https://outlook.office365.com/.default`
* the mailbox you want to send emails from should have a license
* you should grant your app registration full access to this mailbox using PowerShell
* you should also grant the necessary API permission to your app registration:
  * 'APIs my organization uses'
  * search for 'Office 365 Exchange Online'
  * 'Application permissions'
  * 'SMTP.SendAsApp'
* you should grant admin consent for this permission


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.elimity.com/reference-manual/v3.44.2/installation/mail-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
