Skip to content

Reference

github-actions[bot] edited this page Dec 4, 2026 · 1 revision

Reference: commands, flags and paths

What ownmail accepts on the command line and what it answers on its web port. How to run it is in Docker, systemd and Coolify; a quick start on your own computer is in CONTRIBUTING.md.

Commands

Command What
ownmail serve the mail server and its web interface, in one process (below)
ownmail version the version
ownmail admin reset-password a new password for an administrator (below)
ownmail backup, ownmail backup-target, ownmail restore backups and restoring on the command line (Backups)
ownmail updater the update container (Updates)

Every command prints its own flags with -h.

Flags of ownmail serve

serve runs the mail service (ports 25, 587, 465, 993, 4190) and serves the web interface and the API on -listen (default :8080, plain HTTP meant to sit behind a reverse proxy that terminates HTTPS for the mail server's name).

Every flag can also be set in the environment as OWNMAIL_<NAME> (-data is OWNMAIL_DATA, -trusted-proxies is OWNMAIL_TRUSTED_PROXIES); a flag on the command line wins.

Flag Default
-data /data database, secret key, mail, certificates
-listen :8080 web interface and API
-hostname the mail server's name; set here, it cannot be changed in the settings. A URL is taken too: https://mail.example.com/ is mail.example.com (only http:// or https://; a port, a path or an address instead of a name stops the start with a message naming OWNMAIL_HOSTNAME)
-tls acme acme (Let's Encrypt over HTTP on -listen), internal (self-signed), files, or auto: the files while they are there, valid and for the mail server's name. When they are not (missing, for another name, expired), a certificate read from them before stays while it is valid, and after 10 minutes without usable files OwnMail gets its own as with acme; the files are used again once usable. An expired certificate is never used. The log says when the source changes, Server status which one is in use
-tls-cert, -tls-key certificate and key for -tls files and -tls auto (read again when they change)
-acme-email e-mail for the certificate authority
-acme-directory Let's Encrypt another ACME certificate authority
-trusted-proxies addresses or CIDRs whose X-Forwarded-For/X-Forwarded-Proto are believed (below)
-insecure-http off let the admin cookie work over plain HTTP on any name (test setups only)
-server-ip the server's public addresses, for the DNS records to enter
-smtp, -submission, -submissions, -imaps, -managesieve :25, :587, :465, :993, :4190 mail ports ("" turns one off)
-ipv6-outbound off also deliver over IPv6; only when the IPv6 address has a matching reverse name (Docker)
-update-check on look for new versions every 6 hours; false turns it off for good (Updates)
-updates-dir the volume shared with the update container (ownmail updater), which then updates OwnMail on a click
-sync-every 30s how often the mail service is checked against the stored state
-allow-private-mx off deliver to mail servers on private addresses (test setups only)

Paths

What serve answers on -listen:

Path What
/admin, /admin/... the administration in the browser
/, everything else mailbox users sign in with their address and password and manage their own mailbox
/api/... the administration API, with a session or an access token (Usage)
/api/mcp the administration for AI programs, with an access token (MCP)
/account/api/, /dav/, /.well-known/caldav, /.well-known/carddav the mailbox's own account, calendars and contacts
/mcp, /oauth/..., /.well-known/oauth-... one mailbox's mail for AI programs (Usage)
/.well-known/acme-challenge/... the mail server's certificate (-tls acme; the reverse proxy must pass port 80's challenges for the mail server's name on, as Caddy does and Traefik does not, see Docker)
/mail/config-v1.1.xml, /autodiscover/autodiscover.xml settings for mail programs (under autoconfig.<domain> and autodiscover.<domain>; the reverse proxy needs certificates for those names, see Docker)

The two browser pages are built into release binaries and the image. A plain go build leaves them out and answers a short note instead (see CONTRIBUTING.md).

The setup code

On the first start OwnMail prints a one-time setup code to its log. Open the administration and create the first admin with it (or POST /api/setup with {"code", "email", "password"}); without the code nobody can take over a fresh server. A new code is printed on every start until the first admin exists.

Behind a reverse proxy

Tell OwnMail which proxy terminates HTTPS in front of it, so it sees each client's real address (sign-in limits count per client) and knows the connection is secure, for example with a proxy on the same server:

OWNMAIL_DATA=/data \
OWNMAIL_HOSTNAME=mail.example.com \
OWNMAIL_ACME_EMAIL=you@example.com \
OWNMAIL_TRUSTED_PROXIES=127.0.0.1/32,::1/128 \
ownmail serve

The compose file and the systemd unit already set it for their proxy. What the proxy itself must do (certificates, ACME challenges, the names for mail programs) is in Docker.

Without it every client looks like the proxy; OwnMail logs a warning when requests with forwarding headers come from an address it does not trust. The admin session cookie is always marked secure (__Host- prefix) unless OwnMail is opened as localhost or a loopback address, or -insecure-http is set.

Lost the admin password

ownmail admin reset-password -data /var/lib/ownmail you@example.com

prints a new password, ends every session of that admin and turns their two-factor sign-in off. With Docker Compose: docker compose exec ownmail ownmail admin reset-password you@example.com; with systemd, see systemd.

Home

Running OwnMail

Using OwnMail

How it is built

Taking part

Clone this wiki locally