bulk_mark_unread
Mark multiple emails as unread in iCloud Mail, with optional filtering by sender to manage email notifications and organization.
Instructions
Mark all emails as unread, optionally filtered by sender
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailbox | No | Mailbox (default INBOX) | |
| sender | No | Optional: only mark emails from this sender as unread |
Implementation Reference
- lib/imap.js:970-980 (handler)Implementation of the 'bulk_mark_unread' tool handler.
export async function bulkMarkUnread(mailbox = 'INBOX', sender = null, creds = null) { const client = createRateLimitedClient(creds); await client.connect(); await client.mailboxOpen(mailbox); const query = sender ? { from: sender, seen: true } : { seen: true }; const uids = (await client.search(query, { uid: true })) ?? []; if (uids.length === 0) { await client.logout(); return { marked: 0 }; } await client.messageFlagsRemove(uids, ['\\Seen'], { uid: true }); await client.logout(); return { marked: uids.length, sender: sender || 'all' }; }