bulk_mark_read
Mark all emails as read in iCloud Mail, with optional filtering by sender to manage inbox notifications efficiently.
Instructions
Mark all emails as read, 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 read |
Implementation Reference
- lib/imap.js:958-968 (handler)The function bulkMarkRead marks emails as read based on optional sender filter.
export async function bulkMarkRead(mailbox = 'INBOX', sender = null, creds = null) { const client = createRateLimitedClient(creds); await client.connect(); await client.mailboxOpen(mailbox); const query = sender ? { from: sender, seen: false } : { seen: false }; const uids = (await client.search(query, { uid: true })) ?? []; if (uids.length === 0) { await client.logout(); return { marked: 0 }; } await client.messageFlagsAdd(uids, ['\\Seen'], { uid: true }); await client.logout(); return { marked: uids.length, sender: sender || 'all' }; }