---
title: "Administration -- Mailboxes"
weight: 20
description: "Management of IMAP/SMTP accounts, access rights and folder -> label mappings."
source_hash: "e509a9b4"
---

# Administration -- Mailboxes

This tab is the entry point of the configuration. As long as no mailbox is created, the module cannot collect anything.

## Mailbox list (`admin/mailbox_list.php`)

Summary table of the IMAP mailboxes configured in Dolibarr. Each row represents a distinct account (a user can be authorized on several mailboxes).

Displayed columns:

- **Label** -- business name of the mailbox (e.g. "Sales department").
- **Host** -- IMAP server.
- **Login** -- IMAP login (usually the email address).
- **Status** -- active or inactive. An inactive mailbox is not synchronized.

Actions: create a new mailbox, edit, disable, delete.

## Mailbox card (`admin/mailbox_card.php`)

### IMAP section (incoming email collection)

| Field | Description |
|-------|-------------|
| **Label** | Name displayed in the interface (required). |
| **Host** | IMAP server, e.g. `imap.gmail.com` (required). |
| **Port** | IMAP port. Default `993` for SSL/TLS, `143` for STARTTLS. |
| **Encryption** | SSL, TLS, STARTTLS or none. SSL recommended. |
| **Login** | IMAP login (often the full email). Required. |
| **Authentication** | **Password** (default) or **OAuth2 (Google, Microsoft 365)**, which uses a token from the Dolibarr OAuth module instead of the password, for both collection and sending. Procedure: [Connect a Google or Microsoft 365 mailbox via OAuth](/capmail/connecter-oauth). |
| **OAuth service** | In OAuth2 only: the Google or Microsoft provider declared in the Dolibarr OAuth module. |
| **Password** | IMAP password. For Gmail, an app password is required: see [Connect a Gmail mailbox](/capmail/connecter-gmail). Outlook and Microsoft 365 do not accept passwords: choose OAuth2 authentication. |
| **Main folder** | Source folder for collection. Default `INBOX`. |
| **Archive folder** | Target of the "Archive" button. If empty, archiving stays local. |
| **Spam folder** | Target of the "Spam" button. |
| **Sent folder** | Where to copy outgoing emails after SMTP sending. |
| **Trash folder** | Target of the "Delete" button. |
| **Validate TLS certificate** | Yes by default. Set to No only if the server presents a self-signed certificate (self-hosted server, local gateway). The connection stays encrypted, but the server identity is no longer verified. |

The **Detect folders** button queries the server and compares what is configured with what actually exists: it reports missing folders, ambiguous names (several folders with the same name), and proposes the right values from the server's standard attributes. The **Apply detected folders** button writes these proposals.

This is the recommended method rather than typing paths by hand: conventions vary a lot from one hosting provider to another (`INBOX.Sent` at some, `Sent` at others, `[Gmail]/Messages envoyés` at Gmail).

The **Test IMAP connection** button checks the credentials and lists the available folders. The **Create default folders** button creates `Sent`, `Trash`, `Junk`, `Archives`, `Drafts` if only `INBOX` exists.

### SMTP section (sending outgoing emails)

All SMTP fields are **optional**. If not filled in, the module uses the global Dolibarr SMTP configuration.

| Field | Description |
|-------|-------------|
| **SMTP host** | SMTP server (e.g. `smtp.gmail.com`). Empty = global Dolibarr SMTP. |
| **SMTP port** | Default `587` (STARTTLS) or `465` (SSL/TLS). |
| **SMTP login** | Empty = reuses the IMAP login. |
| **SMTP password** | Empty = reuses the IMAP password. |
| **SMTP encryption** | TLS, SSL, STARTTLS or none. |
| **Sender address (From)** | Address displayed as sender. Useful when the technical account differs from the public address (e.g. login `account42@domain.com` but sending from `contact@domain.com`). |

The **Test SMTP connection** button checks sending.

### Folder -> label mappings

Allows a Capmail label to be automatically applied to emails arriving in a given IMAP folder. Useful to visually identify a folder (e.g. "Newsletter" colored yellow in the list).

## Rights matrix (`admin/mailbox_rights.php`)

User x mailbox grid with two checkboxes per cell:

- **Read** -- the user sees the emails of this mailbox.
- **Send** -- the user can send from this mailbox (automatically implies Read).

Administrators have all rights by default. Saving is instant (AJAX) when a box is clicked.

### Detect servers

At creation, the first line of the form asks for the mailbox's **email address**. **Detect servers** fills in the IMAP and SMTP host, port and encryption, the login and the label, from the company domains, known providers, then the DNS records of the domain (see [Personal mailbox](/capmail/configuration#boîte-mail-personnelle)). Then check with **Test connection**.

## Company email domains (`admin/domains.php`)

The **Email domains** tab declares, once and for all, the servers and folders of the company domains (`@your-company.com`). A user whose address belongs to one of them adds their personal mailbox with their address and password, without seeing a single server setting.

To add a domain, click **Add a domain**. The **Pre-fill from an address** field fills the form from an existing address of the domain; complete the folders if needed (Sent, Archives, Junk, Trash), which will be used for each mailbox. Declaring a domain again replaces its configuration.

Only server names, ports between 1 and 65535 and SSL, TLS and STARTTLS encryptions are accepted: these values are used for the connection of each user of the domain.

## Special cases by hosting provider

- **Gmail**: app password required, and special folders prefixed `[Gmail]/` with names translated into the account language. Full procedure: [Connect a Gmail mailbox](/capmail/connecter-gmail).
- **Outlook.com and Microsoft 365**: Microsoft has removed password authentication (the server answers `Basic authentication is disabled.`). Connect the mailbox via OAuth2: see [Connect a Google or Microsoft 365 mailbox via OAuth](/capmail/connecter-oauth).
- **Proton Mail**: not supported. Proton exposes no public IMAP server, access goes through the local Proton Mail Bridge application.
- **`INBOX.` servers** (OVH MX Plan and many Dovecot servers): folders are written `INBOX.Sent`, `INBOX.Archive`, etc. Use **Detect folders** rather than guessing them.

## Tips

- One mailbox per public identity (e.g. `contact@`, `accounting@`, `support@`).
- Disable a mailbox rather than deleting it if you just want to stop collection temporarily (preserves the history).
- The IMAP/SMTP password is encrypted in the database via `dolEncrypt()`.
