delete_mailbox
Remove an empty mailbox or folder from iCloud Mail to organize email storage and manage folder structure.
Instructions
Delete a mailbox/folder. The folder must be empty first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Mailbox path to delete |
Implementation Reference
- lib/imap.js:1254-1268 (handler)Implementation of the delete_mailbox tool. It connects to the IMAP server and uses client.mailboxDelete to delete the specified folder.
export async function deleteMailbox(name, creds = null) { const client = createRateLimitedClient(creds); await client.connect(); try { await Promise.race([ client.mailboxDelete(name), new Promise((_, reject) => setTimeout(() => reject(new Error('delete timed out after 15s — Apple IMAP may not support deleting this folder')), 15000) ) ]); } finally { try { await client.logout(); } catch { client.close(); } } return { deleted: name }; }