English
Switch
Sends the email down the first branch whose conditions match, otherwise down the "otherwise" branch.
The Switch node routes a branch to one of several named outputs. Each rule has a name, a list of conditions and a "Match" setting (all conditions or any condition). Rules are evaluated in order and the first one that matches wins; the following rules are not evaluated. When none matches, the run continues on otherwise.
Conditions use the same fields and operators as the Condition node: email.<field> or a data.<path> produced upstream. For a single yes/no decision, the Condition node is simpler. To route on the meaning of an email rather than on field values, use Categorize.
At a glance
- Type:
flow.switch· version 1 - Category: Logic
- Kind: Step — one stage of a run
- Effect: No external effect (
none) — nothing is written outside Mankomail; safe to replay - Needs a carrier email: No
- Connection: None
- Inputs:
main - Outputs: Computed from the parameters (with the default parameters:
otherwise)
Parameters
rules
Rules — Each rule names one output of the node. The first satisfied rule wins; the following ones are not evaluated.
- Type: List of items (
collection) - Required: No
- 1 to 20 items
- Each item has:
name— Branch name- Type: Text (
string) - Required: Yes
- 120 characters at most
- Example:
Urgent - Expressions:
{{ }}not accepted
- Type: Text (
match— Match- Type: One choice (
options) - Required: Yes
- Default:
all - Options:
all— All conditionsany— Any condition
- Type: One choice (
conditions— Conditions- Type: List of items (
collection) - Required: No
- 1 to 50 items
- Each item has:
field— Field. An email field (email.subject,email.from.domain,email.attachments.mimeTypes) or a working-data path (data.categorize_1.category,data.extract_text_1.count). Example: "has a PDF attachment" =email.attachments.mimeTypescontainsapplication/pdf.- Type: Text (
string) - Required: Yes
- 200 characters at most
- Example:
email.attachments.mimeTypes
- Type: Text (
op— Operator- Type: One choice (
options) - Required: Yes
- Default:
contains - Options:
eq— equalsneq— does not equalcontains— containsstartsWith— starts withendsWith— ends withgt— is greater thanlt— is lower thanexists— is setmatchesDomain— matches domainisEmpty— is empty
- Type: One choice (
value— Value- Type: Text (
string) - Required: No
- 2000 characters at most
- Shown when:
opis not one ofexists,isEmpty
- Type: Text (
caseSensitive— Case sensitive. Comparison ignores case by default; accents always matter.- Type: Yes / no (
boolean) - Required: No
- Default:
false - Shown when:
opis not one ofexists,isEmpty,matchesDomain
- Type: Yes / no (
- Type: List of items (
Outputs
Computed from the parameters.
otherwise— Taken when no rule matches. Always present.case:<rule name>— One port per rule, named after it (a rule namedUrgentdraws the portcase:Urgent). Taken when that rule is the first one whose conditions match.
Data produced
What this node adds to the run data, and how to read it in an expression. <step> stands for the step key: the node name turned into an identifier (see Data and expressions).
{{ data.<step>.branch }}—string. The name of the rule that matched, ornullwhen theotherwisebranch was taken.{{ data.<step>.matched }}—boolean.truewhen a rule matched,falsewhen theotherwisebranch was taken.
Example
Route supplier emails by sender domain. Set rules to:
1. name: Carrier match: any conditions: email.from.domain matches domain carrier.example
email.subject contains tracking
2. name: Accounting match: all conditions: email.attachments.mimeTypes contains application/pdfThe node draws three outputs: case:Carrier, case:Accounting and otherwise. An email from notifications.carrier.example takes case:Carrier even if it also carries a PDF, because the first rule wins. Downstream, {{ data.<step>.branch }} is Carrier.
Tips
- The order of the rules matters. Put the most specific rules first.
- The rule name becomes the port name, so it cannot contain
{{ }}expressions. Renaming a rule renames its port: reconnect the branch afterwards. - Two rules with the same name share the same port, so both lead to the same branch.
- A rule whose name is empty is ignored: it draws no port and is never evaluated.
- Text comparisons ignore case by default; a
data.path that does not exist counts as empty, exactly as in the Condition node.