Self-host Mail server (mox, experimental) on a VPS

Experimental. Needs APP_EXPERIMENTAL=mail on the control plane: without it this template is hidden and cannot be installed. Install with the MAIL_FIRST_DOMAIN setting (templates install mail-mox --env MAIL_FIRST_DOMAIN=example.com). MAIL_HOSTNAME (the FQDN other servers connect to) defaults to mail. that domain and MAIL_ADMIN_EMAIL to postmaster@ that domain. Ports 25, 465, 587 and 993 are published on the host with a private bind by default. After install, open them with the CLI command mail ports open --confirm (or Open mail ports on the Mail page): that makes only those four ports public and allows them in the host firewall, then set up DNS. Webmail and the account UI are on port 8025 (private, no admin pages). The admin API and metrics are never published; never make them public. TLS: the first start makes a self-signed certificate (valid for localhost only, made by mox itself) so the server comes up with no manual steps. Replace it before sending real mail: put your certificate and key in the config volume and set MAIL_TLS_CERT_FILE and MAIL_TLS_KEY_FILE (paths under /mox/config, for example certs/cur.pem and certs/cur.key). Existing files at those paths are never overwritten. A changed certificate needs a container restart. Relay mode: set MAIL_SMARTHOST_HOST (and port, user, password) to send through a provider. Changing it needs a restart. The admin password is the generated secret SERVICE_PASSWORD_MAILADMIN. Back up the config and data volumes together. Deliverability depends on reverse DNS, SPF, DKIM and a clean IP; see the mail template guide. Licence: MIT.

Needs configuration: set MAIL_FIRST_DOMAIN before the first start.

levelrail-cli templates install mail-mox --name my-mail-mox --env MAIL_FIRST_DOMAIN=VALUE

Specification

Status
Listed
Category
Communication
Services
mox
Ports
8081, 25, 465, 587, 993
Volumes
2
Memory
about 256 MiB
arm64
image published
amd64
image published
Settings to fill in
1
License
not yet recorded

About Mail server (mox, experimental)

Experimental. Needs APP_EXPERIMENTAL=mail on the control plane: without it this template is hidden and cannot be installed. Install with the MAIL_FIRST_DOMAIN setting (templates install mail-mox --env MAIL_FIRST_DOMAIN=example.com). MAIL_HOSTNAME (the FQDN other servers connect to) defaults to mail. that domain and MAIL_ADMIN_EMAIL to postmaster@ that domain. Ports 25, 465, 587 and 993 are published on the host with a private bind by default. After install, open them with the CLI command mail ports open --confirm (or Open mail ports on the Mail page): that makes only those four ports public and allows them in the host firewall, then set up DNS. Webmail and the account UI are on port 8025 (private, no admin pages). The admin API and metrics are never published; never make them public. TLS: the first start makes a self-signed certificate (valid for localhost only, made by mox itself) so the server comes up with no manual steps. Replace it before sending real mail: put your certificate and key in the config volume and set MAIL_TLS_CERT_FILE and MAIL_TLS_KEY_FILE (paths under /mox/config, for example certs/cur.pem and certs/cur.key). Existing files at those paths are never overwritten. A changed certificate needs a container restart. Relay mode: set MAIL_SMARTHOST_HOST (and port, user, password) to send through a provider. Changing it needs a restart. The admin password is the generated secret SERVICE_PASSWORD_MAILADMIN. Back up the config and data volumes together. Deliverability depends on reverse DNS, SPF, DKIM and a clean IP; see the mail template guide. Licence: MIT.

What it deploys

Mail server (mox, experimental) runs as one service in a single Compose app, listening on ports 8081, 25, 465, 587, 993, with 2 named volume mounts.

ServiceImageTagPortsVolumes
mox r.xmox.nl/mox:v0.0.17@sha256 8889e7b48fdd5b0b07b51dd11a6d06536334ec442652f2ffb1e1df3a9d45074e 8081, 25, 465, 587, 993 mail_config -> /mox/configmail_data -> /mox/data

Before you install

  • CPU architecture. arm64 listed. Every image lists linux/arm64 in its registry manifest. That is a manifest fact, not proof the app runs on Arm.
  • Listed. It is in the catalog. Back up the data volume before changing an image tag.
  • Host ports. It publishes ports 8081, 25, 465, 587, 993 directly on the host, so open them in the VPS firewall only if you want that.

Settings and environment

You must set MAIL_FIRST_DOMAIN. 1 secret is generated at deploy and stored encrypted. Values are never shown here.

ServiceVariableValue
moxMAIL_ADMIN_EMAILPreset by the template
moxMAIL_ADMIN_PASSWORDGenerated at deploy
moxMAIL_FIRST_DOMAINYou must set this
moxMAIL_HOSTNAMEPreset by the template
moxMAIL_SMARTHOST_HOSTPreset by the template
moxMAIL_SMARTHOST_PASSWORDPreset by the template
moxMAIL_SMARTHOST_PORTPreset by the template
moxMAIL_SMARTHOST_USERPreset by the template
moxMAIL_TLS_CERT_FILEPreset by the template
moxMAIL_TLS_KEY_FILEPreset by the template

Install Mail server (mox, experimental) on a VPS

  1. Install Levelrail on a fresh VPS

    Run this as root on a Linux server (amd64 or arm64) with ports 80 and 443 reachable. The installer prints a setup link.

    curl -fsSL https://levelrail.com/install.sh | sudo sh
  2. Sign in

    Open the setup link, choose a password, then log the CLI in. The CLI install command is curl -fsSL https://levelrail.com/install-cli.sh | sh if the machine does not have it. See Getting started.

    levelrail-cli login --device
  3. Read the template

    Shows the entry, including its full compose.yaml.

    levelrail-cli templates get mail-mox
  4. Install it

    This template has an install form, so the CLI fills each setting from --env, a generated secret or its default. Replace VALUE with your own MAIL_FIRST_DOMAIN.

    levelrail-cli templates install mail-mox --name my-mail-mox --env MAIL_FIRST_DOMAIN=VALUE

    To put a service behind a domain at install, add --domain SERVICE=HOST:

    levelrail-cli templates install mail-mox --name my-mail-mox --domain mox=mail-mox.example.com

Without a domain the app gets an sslip.io address. You can also deploy it from the dashboard: Apps, New app, Browse templates, then Mail server (mox, experimental).

More in Communication

All Communication templates