search_messages
Search emails by subject, sender, or content, with options to filter by mailbox, account, or date range for faster results.
Instructions
Search messages by subject, sender, or content. Prefer 'subject' or 'sender' fields which are fast metadata lookups. The 'content' field searches message bodies and is significantly slower and less reliable — it may trigger full message downloads on IMAP accounts and can time out. WARNING: Mail.app loads all matching messages into memory before applying the limit, so searches on large mailboxes can be very slow. Always narrow results with mailboxName and accountName when possible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | The field to search in | |
| query | No | The search query string (optional when using date filters) | |
| mailboxName | No | Limit search to a specific mailbox (omit to search all mailboxes) | |
| accountName | No | Limit search to a specific account (omit to search all accounts) | |
| limit | No | Maximum number of results to return (default 50) | |
| after | No | Only return messages received after this ISO 8601 date (e.g. 2024-01-15T00:00:00Z) | |
| before | No | Only return messages received before this ISO 8601 date (e.g. 2024-12-31T23:59:59Z) |