batch-flag-messages
Flag multiple email messages (1-100) in a single call, optionally setting a color from Apple Mail's palette. Reports counts of successful and failed flags, enabling efficient bulk email management.
Instructions
Use when: flagging multiple messages (1–100 ids) in one call, optionally with a color (red/orange/yellow/green/blue/purple/gray).
Returns: counts of how many were flagged and how many failed.
Do not use when: flagging just one (use flag-message) or removing flags (use batch-unflag-messages). Get the ids from search-messages or list-messages first. Pass sourceMailbox/sourceAccount (the mailbox you listed the ids from) so each numeric id is pinned to that mailbox; an id that matches in several mailboxes is refused, not guessed.
Note: the color is applied on both routes — AppleScript sets the flag index, IMAP writes the equivalent $MailFlagBit0/1/2 keywords Mail.app reads — so a mixed batch of numeric and imap: ids all end up colored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | ||
| color | No | Optional flag color (Apple Mail palette: red, orange, yellow, green, blue, purple, gray — 'grey' accepted). Omit for Mail's default flag. The color is applied on both routes: AppleScript sets the flag index, and IMAP writes the equivalent $MailFlagBit0/1/2 keywords Mail.app reads — so a smart mailbox keyed on flag color matches either way. | |
| sourceAccount | No | Account the numeric ids were listed from. Required when sourceMailbox is supplied; on its own it pins nothing. | |
| sourceMailbox | No | Mailbox the numeric ids were listed from (e.g. 'INBOX'). Must be paired with sourceAccount to form an unambiguous scope. Ignored for imap: ids. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| errors | No | ||
| failed | No | ||
| mailbox | No | ||
| success | No | ||
| errorsTruncated | No |