create_rule
Create an Outlook inbox rule to automate email handling by matching sender, subject, body, or attachments and applying actions such as moving to a folder, marking as read, or deleting.
Instructions
Create an inbox mail rule.
At least one condition AND one action are required. Conditions
within a rule are AND-ed by Outlook. Pass multiple values in a list
(e.g. sender_contains=["example.com", "monitor.io"]) for OR
within that condition.
Common condition args: sender_contains: Substrings to match against the sender display name or address (e.g. ["example.com"]). subject_contains: Substrings to match against the subject. body_contains: Substrings to match against the message body. body_or_subject_contains: Match either subject or body. from_addresses: Exact email addresses to match (e.g. ["noreply@example.com"]). has_attachments: True/False to require/exclude attachments.
Common action args: move_to_folder: Destination folder id (use list_folders or create_folder to get one). mark_as_read: Mark matching messages as read. delete: Move matching messages to Deleted Items. stop_processing_rules: If True, no further rules run after this one matches. Recommended for routing-to-folder rules.
Other args: sequence: Optional rule order (lower runs first). is_enabled: Whether the rule is active. Default True. mailbox: Optional mailbox for shared mailboxes. include_raw: Include the raw Graph payload.
Returns: The trimmed new rule.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| delete | No | ||
| mailbox | No | ||
| sequence | No | ||
| is_enabled | No | ||
| include_raw | No | ||
| display_name | Yes | ||
| mark_as_read | No | ||
| body_contains | No | ||
| from_addresses | No | ||
| move_to_folder | No | ||
| has_attachments | No | ||
| sender_contains | No | ||
| subject_contains | No | ||
| stop_processing_rules | No | ||
| body_or_subject_contains | No |