move_matching
Bulk move emails matching criteria (sender, subject, or date) from one mailbox to another in a single pass. Requires at least one filter to prevent accidental full-mailbox moves.
Instructions
Bulk-move every email in a source mailbox that matches the given criteria into a destination mailbox, in one pass. Each call matches a single from/subject substring; to file a sender that spans several unrelated addresses, issue one call per address into the same folder. At least one filter (from_filter, subject_filter, after_date, before_date) is required — this guards against accidentally moving an entire mailbox. The destination must already exist (call create_folder first if needed). Omit limit to move ALL matches (fast native bulk move); set limit to cap the count (slower, per-message). Returns the number of messages moved. On very large mailboxes this can take a few minutes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Optional cap on how many messages to move. Omit to move ALL matches (fast native bulk move); set to move at most N (slower, per-message). | |
| after_date | No | Only move messages received after this date. ISO 8601: "YYYY-MM-DD". | |
| before_date | No | Only move messages received before this date. ISO 8601: "YYYY-MM-DD". | |
| from_filter | No | Substring match on the sender — display name OR address, case-insensitive. E.g. "crypto.com" matches both "news.crypto.com" addresses and a "Crypto.com" display name. A sender using several unrelated addresses with no shared substring needs one call per address into the same folder. | |
| src_account | Yes | Source account to scan, e.g. "iCloud". | |
| src_mailbox | No | Source mailbox to scan. Defaults to "INBOX". | INBOX |
| dest_account | Yes | Destination account, e.g. "iCloud". | |
| dest_mailbox | Yes | Destination mailbox name. Must already exist — call create_folder first if needed. | |
| subject_filter | No | Substring match on subject line. |