Skip to main content

chainmail rule create

Create a rule from flags or a rule file; dry-run it first

Usage​

chainmail rule create (--name NAME --query QUERY --action ACTION... | -f FILE) [flags]

Examples​

# file Stripe receipts as they arrive
chainmail rule create --name receipts --account gmail --query 'from:stripe.com subject:receipt' --on-new --action label=Receipts --action archive
# archive read inbox mail older than 30 days, once a day
chainmail rule create --name inbox-cleanup --query 'in:inbox is:read older_than:30d' --every 1d --action archive
chainmail rule create -f receipts.toml

Flags​

--account stringArray an account the rule covers (repeatable; default: every account)
--action stringArray an action, run in the order given (repeatable): label=NAME, unlabel=NAME, copy=FOLDER, move=FOLDER, link_item=ID[,anchor], forward=ADDR[,ADDR...], flag, unflag, read, unread, archive or trash
--at string run once a day at this time, HH:MM in the [rules] timezone
--description string what the rule is for
--disabled create the rule turned off, to turn on later with rule enable
--every string run on a schedule, this long after the last run finished: 15m to 30d, such as 6h or 7d
-f, --file string read the rule from this TOML rule file instead of the field flags
--max-per-run int32 the most messages one run acts on, 1 to 5000 (default 500)
--name string the rule's name: lowercase letters, digits and dashes, starting with a letter or digit
--note string the note the forward action adds above the forwarded message
--on-new run on new mail as the cache takes it
--priority int32 order among rules, lowest first, -1000000 to 1000000 (default 100)
--query string the messages to act on, in the search language
--stop keep later rules off the messages this rule matched

Global flags​

--output string output format: json or table (default $CHAINMAIL_OUTPUT, then cli.toml, then table on a terminal, json otherwise)
--socket string daemon socket (default $CHAINMAIL_SOCKET, then cli.toml, then /run/chainmail/chainmail.sock)

See also​