# Rules and rule sets

Tell Jade what to do with mail when it arrives. Conditions, actions, ordering, and when to bundle rules into a rule set.

Source: https://jade.email/help/rules/

Rules tell Jade how to handle mail: choose a category, set a status, unsubscribe, bounce, send a push notification, or schedule automatic deletion. They run when an email arrives. You can also apply your current rules to existing mail with **Reprocess**.

## Choose where rules apply

Each inbox has an ordered list of rules, called its rule chain. You can add rules to one inbox or share them through a ruleset:

- **Rules added to an inbox** apply only to mail in that inbox.
- **Attached rulesets** are named, reusable groups of rules. Attach a ruleset to several inboxes to give them the same behavior. Editing its rules changes what runs in every inbox that uses it.
- **The default ruleset** attaches automatically when a new inbox receives its first email. Changing the default doesn't attach it to existing inboxes or replace their attached rulesets. You can attach or detach rulesets on those inboxes yourself.

An inbox uses the part of an address before `@`. If you own several domains, mail sent to `newsletter` at any of those domains uses the same inbox and rules. See [Inboxes](https://jade.email/help/inboxes.md).

## Choose when a rule matches

A rule has a condition and one or more actions. When the condition matches, Jade applies the actions.

Choose **Every email** to match all mail in the inboxes where the rule applies, without checking text. Otherwise, add match text and select one or more locations:

| Location             | What Jade searches                                                                                                                                        |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Subject**          | The email's subject line.                                                                                                                                 |
| **Sender**           | The sender addresses in the email's From field.                                                                                                           |
| **Body**             | The email's body.                                                                                                                                         |
| **Headers**          | Header names, such as `List-Unsubscribe` or `X-Spam-Status`, not their values.                                                                            |
| **Recipient domain** | The domain of the address the email was sent to, for example `example.com` in `info@example.com`. This location matches the whole domain, not part of it. |

For every location except **Recipient domain**, text matching is case-insensitive substring matching: `pay` matches `Payment`, `paypal`, and `payable`. Regular expressions aren't supported.

**Any match text in any selected location is enough.** For example, with `receipt` and `invoice` as match texts and **Subject** and **Body** selected, the rule matches if either word appears in either location. Adding text or locations broadens the rule; it doesn't require the email to match all of them.

## How rule order works

Jade checks the inbox's rule chain from top to bottom. An attached ruleset runs at its position in the chain, with its own rules in their listed order.

- A rule that doesn't match makes no changes, and Jade checks the next rule.
- A matching rule applies its actions. Later matching rules can replace its category, status, or **Auto-delete** duration. The last matching value of each type wins; leaving an action unset doesn't undo an earlier rule's action.
- **Stop after this rule** ends the whole inbox chain after the matching rule's actions run. Inside a ruleset, it also skips the rest of that ruleset and every later rule or ruleset on the inbox.

For example, if one matching rule assigns Marketing and a later matching rule assigns Priority, the email ends up in Priority. Enable **Stop after this rule** on the earlier rule if you want its decision to stand instead.

Rule chain evaluation: An email enters the chain at the top. Rules run in order. A matching rule with Stop after this rule enabled skips all later rules. The last matching category, status, or Auto-delete value wins.

Rules run from top to bottom. A matching rule with **Stop after this rule** enabled skips all later rules.

For **Bounce**, **Unsubscribe**, **Send a push notification**, and **Forward to**, Jade skips an action it has already attempted for that email. Repeated matching rules and **Reprocess** don't repeat a recorded attempt, even if it didn't succeed. A notification attempt can reach several devices; it isn't limited to one device.

## What each action does

### Set a category

Choose a category under **Categorize as…**. The email appears in that category. You can manage your categories under Settings → **Categories**. See [Categories](https://jade.email/help/categories.md).

### Set a status

Choose a status under **Mark as…**:

- **Unread** puts the email in the unread section.
- **Read** marks it as read.
- **Pinned** puts it above unread and read mail.
- **Deleted** moves it to Trash.
- **Archived** moves it out of your everyday mail views and into Archive.

Changing status doesn't choose a category. You can set both in the same rule. See [Trash and archive](https://jade.email/help/trash-and-archive.md) for retention and recovery.

### Unsubscribe

**Unsubscribe** asks the sender to stop sending mail. Jade uses the email's standard unsubscribe instructions: a one-click request when supported, or an email to the sender's unsubscribe address.

Not every sender provides supported unsubscribe instructions, and a request doesn't guarantee that the sender stops. This action doesn't delete the received email. Add a status action if you also want to mark it read or move it to Trash.

### Send a push notification

**Send a push notification** alerts you on browsers, installed Jade web apps, and Jade for iPhone installations where you've enabled notifications and notification access is available. One matching email can notify every eligible enabled installation, even though Jade attempts the notification action only once for that email.

Enable notifications on each device under Settings → **Notifications**. See [Notifications](https://jade.email/help/notifications.md).

### Forward to

**Forward to** sends a copy of a matching email to another address you choose. The recipient sees the original message, not a **Fwd:** wrapper. The From line reads *sender* via Jade and shows the Jade inbox address the mail arrived at. Reply-To stays the original sender, so a reply from the destination goes out from the destination's own address, not through Jade. Each rule forwards to one address. The address must be verified under Settings → **Forwarding** before a rule can use it. Forwarding isn't available on trial accounts or for mail received on a trial domain. Reprocessing never forwards the same email to the same address twice.

This action passes the original message along unchanged. The **Forward** button on an open email is different: it writes a new message with a **Fwd:** subject sent from your address. See [Forwarding](https://jade.email/help/settings.md#forwarding).

### Bounce

**Bounce** sends a nondelivery response telling the sender that the mailbox doesn't exist. Jade keeps the received copy.

When you enable **Bounce** in the rule editor:

- If no status is selected, Jade selects **Deleted**, so the received copy goes to Trash. An existing status selection stays selected. You can choose another status.
- Jade clears the category, **Unsubscribe**, **Send a push notification**, **Forward to**, and **Auto-delete** actions from that rule and disables them while Bounce is on.
- Jade enables **Stop after this rule** and keeps it on, so no later rules run for a matching email. Actions from earlier matching rules aren't undone.

Jade can send the nondelivery response only within 24 hours of receipt. Reprocessing older mail doesn't bounce it, but the rule's status action and stop behavior still apply.

**Screen out** in [Screening](https://jade.email/help/screening.md) adds one of these rules to the inbox, matching the **Recipient domain**. Delete it to undo.

### Auto-delete

**Auto-delete** schedules permanent deletion a chosen number of days after the email arrived. Choose 7, 30, or 90 days, or enter a custom duration. If several matching rules set a duration, the last one wins.

Auto-delete skips Trash

Automatic deletion permanently removes the email and its attachments. It bypasses Trash and can't be undone. A rule-scheduled deletion still applies if the rules also mark the email Archived or Deleted.

**Reprocess** recalculates the deletion date from the original receipt time, not from when you reprocess. A 7-day rule applied to a 10-day-old email schedules it for a date that has already passed, so the email is due for permanent deletion.

To cancel a rule-scheduled deletion, remove or turn off every **Auto-delete** action that matches the email, then reprocess the affected mail. Saving the rule change alone doesn't cancel an existing schedule. If the current rules move the email to Trash, the normal Trash retention period still applies.

## Edit rules and rulesets

To edit one inbox's chain, open Settings → Inboxes and choose the inbox. You can also choose **Inbox settings** from an email's menu or use the settings button on its inbox badge.

From the inbox's settings, you can:

- Add, edit, or delete rules for that inbox.
- Attach or detach rulesets.
- Reorder rules and attached rulesets to control which runs first.
- Export a rule or import rules to copy them between inboxes.

To manage shared rules, open Settings → Rulesets and choose a ruleset. You can edit its name and description, make it the default, add or reorder its rules, and see which inboxes use it.

Editing or reordering rules inside a ruleset affects every attached inbox. Moving the ruleset within one inbox's chain changes its position only on that inbox.

## Apply changes to existing mail

Saved rule changes apply to new incoming mail. They don't automatically change mail already in Jade.

After editing rules, use either entry point to apply the current inbox chain to existing mail:

- **One email:** Open its message menu and choose **Reprocess**.
- **Several emails:** Select the messages and choose **Reprocess** from the bulk action bar.

Reprocess is available for live received mail: **Unread**, **Read**, or **Pinned**. It isn't available for mail in Trash or Archive, sent mail, or quarantined mail. Restore or unarchive received mail before reprocessing it.

Reprocessing applies all matching actions, not just categorization. It can change a category or status you chose manually, recalculate or cancel an Auto-delete schedule, and attempt actions that haven't already been attempted for that email. It doesn't repeat a recorded bounce, unsubscribe, or notification attempt.

## Examples

These examples use categories you create under Settings → **Categories**. Save each rule after choosing its condition, actions, and stop behavior.

### Get alerts for verification codes

For verification mail from a service you've given the inbox `accounts`:

1. **Scope:** Open the `accounts` inbox's settings and add a rule before any broader rules that could stop processing.
2. **Condition:** Select **Subject** and add `verification code` as the match text.
3. **Actions:** Set **Categorize as…** to Priority and enable **Send a push notification**. Leave the other actions unset.
4. **Stop behavior:** Enable **Stop after this rule** so later rules can't change the category.

A subject such as `Your verification code is 123456` matches. Jade assigns Priority and attempts to notify your enabled devices. Enable notifications on each device before using the rule.

### File newsletters as read

To give several newsletter inboxes the same behavior:

1. **Scope:** Create a Newsletter ruleset under Settings → Rulesets and add a rule. Attach the ruleset to each newsletter inbox you want it to cover.
2. **Condition:** Select **Every email**.
3. **Actions:** Set **Categorize as…** to Newsletter and **Mark as…** to **Read**. Leave the other actions unset.
4. **Stop behavior:** Leave **Stop after this rule** off so later rules can make exceptions. Put this ruleset before those exception rules in each inbox's chain.

Every email that reaches this rule is categorized as Newsletter and marked read. A later matching rule can change either value. Mail in inboxes without this ruleset is unaffected.

### Bounce mail to a compromised inbox

If an address you handed out starts receiving unwanted mail:

1. **Scope:** Open that inbox's settings and add a rule at the start of its chain, before any attached rulesets.
2. **Condition:** Select **Every email**.
3. **Actions:** With no status selected, enable **Bounce**. Keep the **Deleted** status that Jade selects.
4. **Stop behavior:** Leave the required **Stop after this rule** on.

New mail to this inbox gets a nondelivery response, and the received copy goes to Trash. No later rules run. Your other inboxes are unaffected. Existing mail changes only if you reprocess it, and messages older than 24 hours don't get a nondelivery response.
