# Email Integration

ProcessMaker IDP can import emails with attachments from Outlook365, process the attachments, and store them in ProcessMaker IDP. The email body text will be stored as metadata, allowing searching through the email body. After all ProcessMaker IDP actions have been completed, the email can be moved to the archive folder on the Outlook365 system.

## **Preliminary Steps**

* Access to a server to either deploy the email-importer as a WAR or in a container
* Access to the client email server (URLs, username, password, etc.)
* Connectivity to ProcessMaker IDP and the Keycloak application
* An email importer client should be created in Keycloak with necessary roles

***

## **Create Client and Roles in Keycloak**

1. Navigate to the respective realm and select create
2. Create a client with a name (e.g., emailImporter)
3. Navigate to the client, change the access type to confidential, enable Service Accounts, and click save
4. Navigate to the Credentials tab, copy and save the secret for later use
5. Navigate to the Service Account Roles tab and assign necessary roles to the email importer client

***

## **Create an Email Dossier in ProcessMaker IDP**

1. Log in to ProcessMaker IDP, click the '+' sign, and select 'New dossier'
2. Choose a dossier name and click the 'Create dossier' button
3. Select the 'Dossiers' icon and select the previously created (email) dossier. Use the 'Dossier actions' button to create the required number of sub-folders
4. Select each of the created sub-folders, click the 'info' button, copy the 'Id' and save it for later

***

## **Configuration Files**

Currently, it is only possible to maintain the configuration files outside the ProcessMaker IDP User Interface. The email importer application has two configuration files: `application.yml` and `EmailImporter.json`.

In the `application.yml` the following fields should be configured:

* ProcessMaker IDP webserver URL
* Keycloak token-uri
* Keycloak client-id (previously copied and saved in step 2 of the Keycloak configuration)
* Keycloak client-secret (previously copied and saved in step 4 of the Keycloak configuration)
* Locations config path and name to the `EmailImporter.json` file

The `EmailImporter.json` file is used by the application to configure the location of the email box(es) and their associated dossier folders in ProcessMaker IDP.

<figure><img src="/files/CsNIDPD0Vh19MoYhHZmi" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://processmaker.gitbook.io/idp/idp-administrator/email-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
