bulk_move_by_sender
Move all emails from a specific sender to a designated folder in iCloud Mail. Use this tool to organize your inbox by relocating messages from particular senders in bulk operations.
Instructions
Move all emails from a specific sender to a folder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sender | Yes | Sender email address | |
| targetMailbox | Yes | Destination folder | |
| sourceMailbox | No | Source mailbox (default INBOX) | |
| dryRun | No | Preview only — return count without moving |
Implementation Reference
- lib/imap.js:886-897 (handler)The bulk_move_by_sender tool logic, which connects to IMAP, searches for emails by sender, and calls safeMoveEmails.
export async function bulkMoveBySender(sender, targetMailbox, sourceMailbox = 'INBOX', dryRun = false, creds = null) { const client = createRateLimitedClient(creds); await client.connect(); await client.mailboxOpen(sourceMailbox); const uids = (await client.search({ from: sender }, { uid: true })) ?? []; await client.logout(); if (dryRun) return { dryRun: true, wouldMove: uids.length, sender, sourceMailbox, targetMailbox }; if (uids.length === 0) return { moved: 0 }; await ensureMailbox(targetMailbox, creds); const result = await safeMoveEmails(uids, sourceMailbox, targetMailbox, creds); return { ...result, sender, targetMailbox }; }