mailctl is configured completely by environment variables. The following variables are supported:
| Variable | Description | Default Value |
|---|---|---|
DB_HOST |
Database host | localhost |
DB_PORT |
Database port | 5432 |
DB_NAME |
Database name | mail |
DB_USER |
Database user | mail |
DB_PASSWORD |
Database password | (empty) |
DB_SSLMODE |
SSL mode for database connection | disable |
DB_TLSCACERT |
Path to CA certificate file for SSL verification | (empty) |
DB_TLSCERT |
Path to client certificate file for mutual TLS | (empty) |
DB_TLSKEY |
Path to client private key file for mutual TLS | (empty) |
| Type | Description |
|---|---|
| Domains | Mail domains (managed, relayed, alias, canonical) |
| Mailboxes | User mailboxes and authentication |
| Aliases | Virtual aliases |
| Alias Targets | Recursive and external target addresses of aliases (including send-as) |
| Catchall Targets | Catch-all target addresses for domains |
| Relayed Recipients | Individual recipients on relayed domains |
| Transports | Mail transport configurations |
| Remotes | Remote SMTP relay credentials |
| Send Grants | Permissions for remotes to send as specific addresses |
Each object type supports a subset of the following actions:
list- List all objects in a table or output as JSONcreate- Create a new objectpatch- Update an existing objectrename- Change the identifier of an object (e.g., email address, domain name)disable/enable- Disable or enable an objectdelete/restore- Delete or restore an object
These precede the object type in the command. For example, to list all domains, use:
mailctl list domainsFollowing actions are available:
status- Show current schema version and applied migrationsupgrade- Apply pending migrations to upgrade the schemapurge- Remove all data and drop all tables (use with caution!)ensure-user- Create/sync application-specific database user with limited permissionsdrop-user- Drop application-specific database user
Unlike other commands, these actions are specified after schema. For example, to upgrade the schema, use:
mailctl schema upgradeSee Schema for the full command reference.
# Generate completion script for your shell
mailctl completion bash > /etc/bash_completion.d/mailctl
mailctl completion zsh > ~/.zsh/completions/_mailctl
mailctl completion fish > ~/.config/fish/completions/mailctl.fish
mailctl completion powershell > mailctl.ps1