rename_mailbox
Rename an existing iCloud Mail mailbox or folder by specifying the current and new mailbox paths to reorganize your email structure.
Instructions
Rename an existing mailbox/folder
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| oldName | Yes | Current mailbox path | |
| newName | Yes | New mailbox path |
Implementation Reference
- lib/imap.js:1238-1252 (handler)Implementation of rename_mailbox tool. Uses imapflow's mailboxRename method with a timeout wrapper.
export async function renameMailbox(oldName, newName, creds = null) { const client = createRateLimitedClient(creds); await client.connect(); try { await Promise.race([ client.mailboxRename(oldName, newName), new Promise((_, reject) => setTimeout(() => reject(new Error('rename timed out after 15s — Apple IMAP may not support renaming this folder')), 15000) ) ]); } finally { try { await client.logout(); } catch { client.close(); } } return { renamed: { from: oldName, to: newName } }; }