bulk_update_flags
Bulk add or remove IMAP flags (like \Seen or \Flagged) on multiple emails at once using explicit IDs or search criteria. Prevents runaway operations with batch limits and dry-run mode.
Instructions
Add or remove IMAP flags on multiple messages simultaneously. Use when the same flag change (e.g. \Seen, \Flagged) should apply to several messages. Accepts emailIds[] OR match+folder (XOR). Returns notApplied[] per message for flags the server silently dropped. Prefer update_message_flags for a single message when you need per-flag server verification.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| match | No | Search criteria. XOR with emailIds. | |
| dryRun | No | ||
| folder | No | Source folder (required with match). | |
| emailIds | No | Explicit email IDs. XOR with match. | |
| flagsToAdd | No | IMAP flags to set, e.g. ["\\Seen", "\\Flagged"]. | |
| maxBatchSize | No | Maximum number of messages to process. Defaults to 500. Use to prevent runaway operations. | |
| flagsToRemove | No | IMAP flags to clear. |