Skip to content

Latest commit

 

History

History
69 lines (59 loc) · 3.45 KB

README.md

File metadata and controls

69 lines (59 loc) · 3.45 KB

CLI Reference

Configuration

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)

Commands

Database Objects

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 JSON
  • create - Create a new object
  • patch - Update an existing object
  • rename - Change the identifier of an object (e.g., email address, domain name)
  • disable/enable - Disable or enable an object
  • delete/restore - Delete or restore an object

These precede the object type in the command. For example, to list all domains, use:

mailctl list domains

Schema Management

Following actions are available:

  • status - Show current schema version and applied migrations
  • upgrade - Apply pending migrations to upgrade the schema
  • purge - Remove all data and drop all tables (use with caution!)
  • ensure-user - Create/sync application-specific database user with limited permissions
  • drop-user - Drop application-specific database user

Unlike other commands, these actions are specified after schema. For example, to upgrade the schema, use:

mailctl schema upgrade

See Schema for the full command reference.

Tips & Tricks

Shell Completion

# 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