Domains, mailboxes, aliases.
Create and edit hosted domains, mailbox quotas, passwords, aliases, and catch-all style routing from scripts.
domain mailbox alias CLI for mailcow operators
Script mailcow without clicking through the admin UI. mailcowctl talks
to the mailcow REST API and covers domains, mailboxes, aliases,
migration helpers, routing maps, resources, and quarantine operations.
Fast path
export MAILCOW_HOST=https://mail.example.org
export MAILCOW_API_KEY=000000-000000-000000-000000-000000
mailcowctl domain list
mailcowctl mailbox list --domain example.org -o json
printf '%s\n' "$NEW_PASSWORD" | mailcowctl mailbox create [email protected] \
--name "Me" --quota 3072 --password-stdin What it does
The command set maps to the mailcow objects operators touch during provisioning, migration, routing changes, and day-to-day response.
Create and edit hosted domains, mailbox quotas, passwords, aliases, and catch-all style routing from scripts.
domain mailbox alias Inspect DKIM records, create imapsync jobs, export sieve filters, recreate app passwords, and carry policy lists forward.
dkim syncjob apppass filter policy Manage transports, BCC maps, recipient rewrites, TLS policies, sender relay hosts, and forwarding hosts.
transport bcc recipient tlspolicy relayhost fwdhost Review quarantine, release messages, train ham, purge held mail, and manage calendar resources.
quarantine resource Install
Releases publish Linux and macOS archives for amd64 and arm64 with checksums. Go 1.22 or newer can install the latest version directly.
# Download from:
https://github.com/elcamino/mailcowctl/releases
tar -xzf mailcowctl_<version>_<os>_<arch>.tar.gz
install -m 0755 mailcowctl /usr/local/bin/mailcowctl go install github.com/elcamino/mailcowctl@latest git clone https://github.com/elcamino/mailcowctl.git
cd mailcowctl
go test ./...
go build -o mailcowctl . API access
mailcow authenticates API calls with X-API-Key and restricts keys by
source IP. Use a read-write key for commands that create, edit, delete,
release, or learn mail.
mailcowctl should change mailcow state.Edit mailcow.conf on the mailcow host, or .env if that is how the deployment is managed.
API_KEY=$(openssl rand -hex 32)
API_ALLOW_FROM=127.0.0.1,203.0.113.10,198.51.100.20 Restart or recreate the affected mailcow containers after changing the API settings.
Configure mailcowctl
Resolution order is flags first, then environment, then
$XDG_CONFIG_HOME/mailcowctl/config.yaml or
~/.config/mailcowctl/config.yaml.
export MAILCOW_HOST=https://mail.example.org
export MAILCOW_API_KEY="$API_KEY"
mailcowctl domain list mailcowctl \
--host https://mail.example.org \
--api-key "$MAILCOW_API_KEY" \
domain list current_profile: prod
profiles:
prod:
host: https://mail.example.org
api_key: 000000-000000-000000-000000-000000 Examples
mailcowctl domain create example.org \
--description Example \
--mailboxes 10 \
--aliases 400 \
--quota 10240 mailcowctl alias create [email protected] \
--goto [email protected]
mailcowctl alias delete [email protected] --yes mailcowctl dkim get example.org --dns
mailcowctl filter get 42 -o json
mailcowctl syncjob list mailcowctl quarantine list --rcpt [email protected]
mailcowctl quarantine release 12345
mailcowctl quarantine delete 12345 --yes