Preview a folder rule (beta)
preview_add_rulePreview a custom INBOX folder rule before saving it. Returns the normalized rule and a single-use approval token without changing anything.
Instructions
Beta: Preview saving one custom folder rule that this server applies to INBOX; returns the rule and a single-use token, and changes nothing.
The rules engine is not fully reliable yet; preview first and check the results.
Use it for a rule this server applies to INBOX whenever preview_rules and apply_rules run, or the operator's optional timer; use preview_sieve_filter when the user wants Proton itself to file mail as it arrives, and preview_action for a one-off move. Show the rule and obtain explicit user approval before add_rule. Saving moves no mail; list_rules shows the existing rules.
The rule model is preview_sieve_filter's: conditions are 1 to 10 objects such as {"field": "subject", "contains": "invoice"}; from and to match each address, subject the decoded header, case-insensitively. A saved rule runs after every existing rule (the first match wins). mark_read applies when apply_rules runs it; the timer never marks mail read. include_matches=true adds a read-only count and samples from one search over at most 200 newest INBOX candidates.
Returns the normalized rule, rule_sha256, the same rule as a Proton Sieve script (informational, for Proton's own filter settings) with script_sha256, apply, token, expires_at and action_hash. A name an existing rule uses, in any letter case, refuses. With 20 saved rules the store is full: apply.available is false and add_rule refuses.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | A name for the rule. A name an existing saved rule uses, in any letter case, refuses. | |
| match | No | all needs every condition to match; any needs one. | all |
| folder | Yes | An existing real Folders/ name, as search_mail reports it. | |
| mark_read | No | Also mark matching mail read. | |
| conditions | Yes | 1 to 10 objects, each {"field": "from"|"to"|"subject"} plus exactly one of contains or is. | |
| include_matches | No | true adds a read-only count and samples of current INBOX matches. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||