# mail
URL: https://openship.io/docs/cli/reference/mail

Commands, arguments, and options for openship mail.

See the [workflow guide](/docs/cli/self-host) for examples. Global flags such as `--json` go before the command; see [global options](/docs/cli/reference#global-options).

## openship mail [#openship-mail]

Self-hosted mail server (iRedMail) setup and admin \[self-host]

```text
openship mail [options] [command]
```

| Subcommand                                                                                                     | Purpose                                                                         |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [`steps`](/docs/cli/reference/mail#openship-mail-steps)                                                        | List the mail setup steps                                                       |
| [`status [serverId]`](/docs/cli/reference/mail#openship-mail-status)                                           | Show the setup progress for a mail server                                       |
| [`servers`](/docs/cli/reference/mail#openship-mail-servers)                                                    | List every server the mail stack is installed on                                |
| [`scan <serverId>`](/docs/cli/reference/mail#openship-mail-scan)                                               | Probe a server for an existing mail install (read-only)                         |
| [`adopt <serverId>`](/docs/cli/reference/mail#openship-mail-adopt)                                             | Re-adopt an existing mail install whose orchestrator state was lost             |
| [`setup [options] <serverId>`](/docs/cli/reference/mail#openship-mail-setup)                                   | Start or resume the mail setup wizard (streams over SSE)                        |
| [`cancel`](/docs/cli/reference/mail#openship-mail-cancel)                                                      | Cancel the mail setup currently running                                         |
| [`dns-ack <serverId>`](/docs/cli/reference/mail#openship-mail-dns-ack)                                         | Acknowledge that DNS records are published (releases the DKIM gate)             |
| [`ptr-ack <serverId>`](/docs/cli/reference/mail#openship-mail-ptr-ack)                                         | Acknowledge that reverse DNS (PTR) is configured                                |
| [`reset [options] <serverId>`](/docs/cli/reference/mail#openship-mail-reset)                                   | Wipe the on-server setup state file (does NOT touch installed daemons)          |
| [`forget <serverId>`](/docs/cli/reference/mail#openship-mail-forget)                                           | Stop managing a mail server (drops the DB row; leaves the stack + state intact) |
| [`health [options] <serverId>`](/docs/cli/reference/mail#openship-mail-health)                                 | Show live status of every mail daemon, and whether mail is leaving the box      |
| [`logs [options] <serverId> <component>`](/docs/cli/reference/mail#openship-mail-logs)                         | Tail a mail component's journal (snapshot)                                      |
| [`postmaster`](/docs/cli/reference/mail#openship-mail-postmaster)                                              | Manage the postmaster mailbox                                                   |
| [`build [options]`](/docs/cli/reference/mail#openship-mail-build)                                              | Build the openship-mail engine image locally from a source checkout \[dev]      |
| [`domain`](/docs/cli/reference/mail/domain#openship-mail-domain)                                               | Manage mail domains, their dependencies and DNS                                 |
| [`mailbox`](/docs/cli/reference/mail/mailbox#openship-mail-mailbox)                                            | Manage mailbox accounts and storage limits                                      |
| [`alias`](/docs/cli/reference/mail/alias#openship-mail-alias)                                                  | Manage forwards and catch-all addresses                                         |
| [`certificate`](/docs/cli/reference/mail#openship-mail-certificate)                                            | Inspect and renew mail TLS through Openship's shared edge                       |
| [`relay`](/docs/cli/reference/mail#openship-mail-relay)                                                        | Manage outbound SMTP delivery without exposing stored passwords                 |
| [`backup`](/docs/cli/reference/mail#openship-mail-backup)                                                      | Manage mail backup policy; use openship backup for runs and restores            |
| [`inbound`](/docs/cli/reference/mail/inbound#openship-mail-inbound)                                            | Manage inbound-mail notification rules                                          |
| [`stats <server>`](/docs/cli/reference/mail#openship-mail-stats)                                               | Read domain, account and storage totals                                         |
| [`dns-scan [options] <server>`](/docs/cli/reference/mail#openship-mail-dns-scan)                               | Inspect mail DNS without changing records                                       |
| [`test-email [options] <server>`](/docs/cli/reference/mail#openship-mail-test-email)                           | Send one delivery test to the specified recipient                               |
| [`rotate-platform-mailbox [options] <server>`](/docs/cli/reference/mail#openship-mail-rotate-platform-mailbox) | Rotate Openship's private delivery credential; never prints its password        |
| [`component [options] <server> <key> <action>`](/docs/cli/reference/mail#openship-mail-component)              | Control a managed mail component; inspect health to confirm recovery            |
| [`restart-all [options] <server>`](/docs/cli/reference/mail#openship-mail-restart-all)                         | Restart managed mail components; delivery may be briefly interrupted            |
| [`webmail`](/docs/cli/reference/mail#openship-mail-webmail)                                                    | Deploy webmail through the normal app deployment workflow                       |

## openship mail adopt [#openship-mail-adopt]

Re-adopt an existing mail install whose orchestrator state was lost

```text
openship mail adopt [options] <serverId>
```

| Argument   | Meaning            |
| ---------- | ------------------ |
| `serverId` | Server ID to adopt |

## openship mail backup [#openship-mail-backup]

Manage mail backup policy; use openship backup for runs and restores

```text
openship mail backup [options] [command]
```

| Subcommand                                                                                   | Purpose                                                                          |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [`get <server>`](/docs/cli/reference/mail#openship-mail-backup-get)                          | Read the current mail backup policy                                              |
| [`configure [options] <id> [file]`](/docs/cli/reference/mail#openship-mail-backup-configure) | Set destination, schedule and included mail data; omitted retention is preserved |
| [`runs <server>`](/docs/cli/reference/mail#openship-mail-backup-runs)                        | Read the 50 most recent mail backup runs                                         |

## openship mail backup configure [#openship-mail-backup-configure]

Set destination, schedule and included mail data; omitted retention is preserved

```text
openship mail backup configure [options] <id> [file]
```

| Argument | Meaning                         |
| -------- | ------------------------------- |
| `id`     | Resource ID                     |
| `file`   | JSON input file, or - for stdin |

| Option     | Meaning                                                 |
| ---------- | ------------------------------------------------------- |
| `--schema` | Print the accepted JSON schema without making a request |

## openship mail backup get [#openship-mail-backup-get]

Read the current mail backup policy

```text
openship mail backup get [options] <server>
```

## openship mail backup runs [#openship-mail-backup-runs]

Read the 50 most recent mail backup runs

```text
openship mail backup runs [options] <server>
```

## openship mail build [#openship-mail-build]

Build the openship-mail engine image locally from a source checkout \[dev]

```text
openship mail build [options]
```

| Option            | Meaning                                                               |
| ----------------- | --------------------------------------------------------------------- |
| `--context <dir>` | Repo root containing apps/email/Dockerfile (default: checkout or cwd) |
| `--tag <ref>`     | Image ref to tag (default: the pinned openship-mail ref)              |

## openship mail cancel [#openship-mail-cancel]

Cancel the mail setup currently running

```text
openship mail cancel [options]
```

## openship mail certificate [#openship-mail-certificate]

Inspect and renew mail TLS through Openship's shared edge

```text
openship mail certificate [options] [command]
```

| Subcommand                                                                                       | Purpose                                                                         |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
| [`get <server>`](/docs/cli/reference/mail#openship-mail-certificate-get)                         | get mail certificate status                                                     |
| [`check <server>`](/docs/cli/reference/mail#openship-mail-certificate-check)                     | check mail certificate status                                                   |
| [`renew <server>`](/docs/cli/reference/mail#openship-mail-certificate-renew)                     | Renew a due certificate and reload SMTP/IMAP through the existing edge workflow |
| [`auto-renew [options] <server>`](/docs/cli/reference/mail#openship-mail-certificate-auto-renew) | Enable or disable scheduled renewal; monitoring remains available               |

## openship mail certificate auto-renew [#openship-mail-certificate-auto-renew]

Enable or disable scheduled renewal; monitoring remains available

```text
openship mail certificate auto-renew [options] <server>
```

| Option            | Meaning                                  |
| ----------------- | ---------------------------------------- |
| `--state <state>` | Automatic renewal (choices: "on", "off") |

## openship mail certificate check [#openship-mail-certificate-check]

check mail certificate status

```text
openship mail certificate check [options] <server>
```

## openship mail certificate get [#openship-mail-certificate-get]

get mail certificate status

```text
openship mail certificate get [options] <server>
```

## openship mail certificate renew [#openship-mail-certificate-renew]

Renew a due certificate and reload SMTP/IMAP through the existing edge workflow

```text
openship mail certificate renew [options] <server>
```

## openship mail component [#openship-mail-component]

Control a managed mail component; inspect health to confirm recovery

```text
openship mail component [options] <server> <key> <action>
```

| Argument | Meaning                 |
| -------- | ----------------------- |
| `server` |                         |
| `key`    |                         |
| `action` | start, stop, or restart |

| Option      | Meaning                  |
| ----------- | ------------------------ |
| `-y, --yes` | Confirm component action |

## openship mail dns-ack [#openship-mail-dns-ack]

Acknowledge that DNS records are published (releases the DKIM gate)

```text
openship mail dns-ack [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

## openship mail dns-scan [#openship-mail-dns-scan]

Inspect mail DNS without changing records

```text
openship mail dns-scan [options] <server>
```

| Option              | Meaning           |
| ------------------- | ----------------- |
| `--domain <domain>` | Domain to inspect |

## openship mail forget [#openship-mail-forget]

Stop managing a mail server (drops the DB row; leaves the stack + state intact)

```text
openship mail forget [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

## openship mail health [#openship-mail-health]

Show live status of every mail daemon, and whether mail is leaving the box

```text
openship mail health [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

| Option                   | Meaning                              |
| ------------------------ | ------------------------------------ |
| `--refresh-reachability` | Bypass the public reachability cache |

## openship mail logs [#openship-mail-logs]

Tail a mail component's journal (snapshot)

```text
openship mail logs [options] <serverId> <component>
```

| Argument    | Meaning                                                                  |
| ----------- | ------------------------------------------------------------------------ |
| `serverId`  | Mail server ID                                                           |
| `component` | Component key (postfix\|dovecot\|amavis\|clamav\|iredapd\|postgresql\|…) |

| Option            | Meaning                                   |
| ----------------- | ----------------------------------------- |
| `-n, --lines <n>` | Number of lines (max 1000) (default: 200) |

## openship mail postmaster [#openship-mail-postmaster]

Manage the postmaster mailbox

```text
openship mail postmaster [options] [command]
```

| Subcommand                                                                                            | Purpose                        |
| ----------------------------------------------------------------------------------------------------- | ------------------------------ |
| [`set-password [options] <serverId>`](/docs/cli/reference/mail#openship-mail-postmaster-set-password) | Rotate the postmaster password |

## openship mail postmaster set-password [#openship-mail-postmaster-set-password]

Rotate the postmaster password

```text
openship mail postmaster set-password [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

| Option                   | Meaning                                                                |
| ------------------------ | ---------------------------------------------------------------------- |
| `--password <password>`  | New password (min 12 chars); prompted if omitted                       |
| `--password-file <file>` | Password file, or - for stdin (keeps secrets out of process arguments) |

## openship mail ptr-ack [#openship-mail-ptr-ack]

Acknowledge that reverse DNS (PTR) is configured

```text
openship mail ptr-ack [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

## openship mail relay [#openship-mail-relay]

Manage outbound SMTP delivery without exposing stored passwords

```text
openship mail relay [options] [command]
```

| Subcommand                                                                                  | Purpose                                                      |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [`get <server>`](/docs/cli/reference/mail#openship-mail-relay-get)                          | Read masked relay settings                                   |
| [`configure [options] <id> [file]`](/docs/cli/reference/mail#openship-mail-relay-configure) | Configure outbound SMTP; omit password to keep the saved one |
| [`remove [options] <server>`](/docs/cli/reference/mail#openship-mail-relay-remove)          | Disable the relay and return to direct SMTP delivery         |

## openship mail relay configure [#openship-mail-relay-configure]

Configure outbound SMTP; omit password to keep the saved one

```text
openship mail relay configure [options] <id> [file]
```

| Argument | Meaning                         |
| -------- | ------------------------------- |
| `id`     | Resource ID                     |
| `file`   | JSON input file, or - for stdin |

| Option      | Meaning                                                 |
| ----------- | ------------------------------------------------------- |
| `--schema`  | Print the accepted JSON schema without making a request |
| `-y, --yes` | Confirm this operation                                  |

## openship mail relay get [#openship-mail-relay-get]

Read masked relay settings

```text
openship mail relay get [options] <server>
```

## openship mail relay remove [#openship-mail-relay-remove]

Disable the relay and return to direct SMTP delivery

```text
openship mail relay remove [options] <server>
```

| Option      | Meaning                 |
| ----------- | ----------------------- |
| `-y, --yes` | Confirm direct delivery |

## openship mail reset [#openship-mail-reset]

Wipe the on-server setup state file (does NOT touch installed daemons)

```text
openship mail reset [options] <serverId>
```

| Argument   | Meaning        |
| ---------- | -------------- |
| `serverId` | Mail server ID |

| Option      | Meaning                      |
| ----------- | ---------------------------- |
| `-y, --yes` | Skip the confirmation prompt |

## openship mail restart-all [#openship-mail-restart-all]

Restart managed mail components; delivery may be briefly interrupted

```text
openship mail restart-all [options] <server>
```

| Option      | Meaning         |
| ----------- | --------------- |
| `-y, --yes` | Confirm restart |

## openship mail rotate-platform-mailbox [#openship-mail-rotate-platform-mailbox]

Rotate Openship's private delivery credential; never prints its password

```text
openship mail rotate-platform-mailbox [options] <server>
```

| Option      | Meaning          |
| ----------- | ---------------- |
| `-y, --yes` | Confirm rotation |

## openship mail scan [#openship-mail-scan]

Probe a server for an existing mail install (read-only)

```text
openship mail scan [options] <serverId>
```

| Argument   | Meaning           |
| ---------- | ----------------- |
| `serverId` | Server ID to scan |

## openship mail servers [#openship-mail-servers]

List every server the mail stack is installed on

```text
openship mail servers [options]
```

## openship mail setup [#openship-mail-setup]

Start or resume the mail setup wizard (streams over SSE)

```text
openship mail setup [options] <serverId>
```

| Argument   | Meaning                                |
| ---------- | -------------------------------------- |
| `serverId` | Server ID to install the mail stack on |

| Option                  | Meaning                                                       |
| ----------------------- | ------------------------------------------------------------- |
| `-d, --domain <domain>` | Mail domain (e.g. example.com)                                |
| `--start-step <n>`      | Resume from a step returned by mail status                    |
| `--config <json>`       | iRedMail config overrides as a JSON object                    |
| `--config-file <file>`  | Setup config file, or - for stdin (recommended for passwords) |

## openship mail stats [#openship-mail-stats]

Read domain, account and storage totals

```text
openship mail stats [options] <server>
```

## openship mail status [#openship-mail-status]

Show the setup progress for a mail server

```text
openship mail status [options] [serverId]
```

| Argument   | Meaning                                           |
| ---------- | ------------------------------------------------- |
| `serverId` | Mail server ID (omit for the empty welcome shell) |

## openship mail steps [#openship-mail-steps]

List the mail setup steps

```text
openship mail steps [options]
```

## openship mail test-email [#openship-mail-test-email]

Send one delivery test to the specified recipient

```text
openship mail test-email [options] <server>
```

| Option                   | Meaning                             |
| ------------------------ | ----------------------------------- |
| `--to <email>`           | Recipient for one real test message |
| `--from-domain <domain>` | Sender's configured mail domain     |

## openship mail webmail [#openship-mail-webmail]

Deploy webmail through the normal app deployment workflow

```text
openship mail webmail [options] [command]
```

| Subcommand                                                                                           | Purpose                                                         |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`targets <server>`](/docs/cli/reference/mail#openship-mail-webmail-targets)                         | List permitted targets for this mail server                     |
| [`deploy [options] [file]`](/docs/cli/reference/mail#openship-mail-webmail-deploy)                   | Deploy webmail and return IDs for openship deployment wait/logs |
| [`deploy-external [options] [file]`](/docs/cli/reference/mail#openship-mail-webmail-deploy-external) | Deploy webmail for an external IMAP/SMTP provider               |

## openship mail webmail deploy [#openship-mail-webmail-deploy]

Deploy webmail and return IDs for openship deployment wait/logs

```text
openship mail webmail deploy [options] [file]
```

| Argument | Meaning                         |
| -------- | ------------------------------- |
| `file`   | JSON input file, or - for stdin |

| Option      | Meaning                                                 |
| ----------- | ------------------------------------------------------- |
| `--schema`  | Print the accepted JSON schema without making a request |
| `-y, --yes` | Confirm this operation                                  |

## openship mail webmail deploy-external [#openship-mail-webmail-deploy-external]

Deploy webmail for an external IMAP/SMTP provider

```text
openship mail webmail deploy-external [options] [file]
```

| Argument | Meaning                         |
| -------- | ------------------------------- |
| `file`   | JSON input file, or - for stdin |

| Option     | Meaning                                                 |
| ---------- | ------------------------------------------------------- |
| `--schema` | Print the accepted JSON schema without making a request |

## openship mail webmail targets [#openship-mail-webmail-targets]

List permitted targets for this mail server

```text
openship mail webmail targets [options] <server>
```
