# Mailbox configuration

Configure **Mailbox Configuration** to send email from OpenIAM and, if needed, process incoming email automatically. This setup is required for email notifications, password reset links, and email-based one-time passwords (OTP).

{% stepper %}
{% step %}

### Find the mailbox configuration page

Sign in to the **Webconsole**. Then go to **Administration → Mailbox configuration**.

![](/files/da3806cee4ed26318b79953d4916809a089cf89a)

This page lists the predefined mailbox configurations in your system. By default, you may see a configuration migrated from an earlier OpenIAM version or from the older **System configuration → SMTP Gateway** page.
{% endstep %}

{% step %}

### Review the mailbox configuration options

Members of the **Super Security Admin** role can access four options in the left menu:

* Create Mailbox Configuration Template
* Create Mailbox Configuration
* Mailbox Configuration Templates
* Mailbox Configurations

![Mailbox configuration menu](/files/bbfd68835f82b2960f081b47d824c2a8368a7743)

#### Mailbox configurations

This is the default view. It lists all mailbox configurations available in the system. You can search by name with the `Search for Mailbox Configuration` field.

<figure><img src="/files/4ecb7c7e67478f0988e24e8d3cce95b628089149" alt=""><figcaption></figcaption></figure>

#### Mailbox configuration templates

This page lists all mailbox configuration templates available in the system.

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

OpenIAM includes **five default templates**.
{% endstep %}

{% step %}

### Create a mailbox configuration template

Create a mailbox configuration template when you need SMTP or IMAP settings that differ from the default templates.

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

Fill in the fields with the values provided by your SMTP or IMAP service.

| Parameter name         | Description                                                                           | Example                        |
| ---------------------- | ------------------------------------------------------------------------------------- | ------------------------------ |
| Name                   | User-friendly name of the configuration template                                      | My Company Mailbox             |
| SMTP Host Name         | Host name of your SMTP provider                                                       | smtp.office365.com             |
| SMTP Port              | Port that your SMTP host listens on                                                   | 587                            |
| SMTP auth              | Lets the OpenIAM mail client authenticate with the server                             | True                           |
| Start TLS enabled      | Starts secure email communication                                                     | True                           |
| Socket factory class   | Internal factory used for socket communication. Use `javax.net.ssl.SSLSocketFactory`. | javax.net.ssl.SSLSocketFactory |
| Socket factory port    | Fallback port                                                                         | 587                            |
| Socket fallback        | Enables socket fallback                                                               | True                           |
| Incoming mail hostname | Host name used to process incoming email                                              | imap.office365.com             |
| IMAP Port              | Port used by your mail server for IMAP                                                | 993                            |
| Inbox folder           | Inbox folder name when OpenIAM processes incoming email                               |                                |
| IMAP SSL Enabled       | Enables SSL for IMAP                                                                  | True                           |

The same page is used to edit a mailbox configuration template. Before you delete a template, make sure no mailbox configurations are linked to it. Otherwise, OpenIAM returns an error:

{% hint style="info" %}
Mailbox Configuration Template was not deleted because one or more mailbox configurations still use it. Delete the related mailbox configurations first.
{% endhint %}
{% endstep %}

{% step %}

### Create a mailbox configuration

Create a mailbox configuration to send email from the installation through SMTP and, if needed, receive email for automatic processing.

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

Fill in the fields with the values from your mailbox account and selected template.

| Parameter name                                 | Description                                                                                                                                             | Example                                                 |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| Name                                           | User-friendly name of the configuration                                                                                                                 | My Mailbox #1                                           |
| Is Active                                      | Enables or disables this configuration                                                                                                                  | true/false                                              |
| Read Inbox?                                    | Lets OpenIAM read the inbox for this mailbox. Use this for automatic email processing.                                                                  | true/false                                              |
| Default sender (Usually the same as UserName): | Sender shown to the recipient. This is usually the same as the username because of SMTP relay requirements.                                             | <no-reply@mycorp.com>                                   |
| Default subject prefix                         | Optional prefix added to the subject of every email sent by OpenIAM                                                                                     | \[OpenIAM Dev server]                                   |
| Optional Bcc address                           | Email addresses to add as BCC for all outgoing email                                                                                                    |                                                         |
| SMTP username                                  | Username used to authenticate to the mailbox                                                                                                            | <no-reply@mycorp.com>                                   |
| SMTP password                                  | Password for the mailbox account                                                                                                                        | *password-for-no-reply*                                 |
| Failover Mailbox Configuration                 | Mailbox configuration used if the current one cannot send email. OpenIAM can trigger the failover configuration even if its **Active** flag is `false`. |                                                         |
| Mailbox Configuration Template                 | Template used for the current mailbox credentials and connection settings                                                                               | Office 365 SMTP Relay                                   |
| Script to customize MimeMessage message        | Optional Groovy script that customizes the MIME message by adding properties or logic                                                                   | Empty by default. Contains the path to a Groovy script. |
| {% endstep %}                                  |                                                                                                                                                         |                                                         |
| {% endstepper %}                               |                                                                                                                                                         |                                                         |

{% hint style="info" %}
If multiple mailbox configurations are active, OpenIAM uses round-robin delivery across them. A mailbox configuration marked as failover is used only when the primary configuration fails.
{% endhint %}


---

# 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://docs-beta.openiam.com/configuring-multi-factor-authentication/mailbox-configuration.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.
