imap_bulk_delete_by_search
Delete emails in bulk by matching sender, subject, or date criteria. At least one filter is required to avoid wiping a whole folder; dry-run lets you preview first.
Instructions
Search for emails matching criteria and delete them all. Useful for cleaning up spam or unwanted emails. At least one concrete criterion (from, to, subject, before, or since) is REQUIRED — a call with no criteria is refused so it can never wipe an entire folder. Supports dryRun to preview matches first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Delete emails to this recipient | |
| from | No | Delete emails from this sender | |
| since | No | Delete emails since this date (YYYY-MM-DD) | |
| before | No | Delete emails before this date (YYYY-MM-DD) | |
| dryRun | No | If true, only return what would be deleted without actually deleting | |
| folder | No | Folder name | INBOX |
| subject | No | Delete emails with this subject | |
| accountId | No | Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured. | |
| chunkSize | No | Number of emails to delete per batch | |
| accountName | No | Account name instead of accountId. Optional if accountId is given or only one account is configured. |