top_senders
Generate a frequency table of top email senders in a folder, sorted by message count. Filter by date range and optionally exclude your own address.
Instructions
Return a frequency table of top senders for a folder, optionally filtered by date range. Buckets are keyed by lowercased email address. Default limit 20, scanLimit 5000 (max 20000). Each row carries a direction of "self" or "received" so callers can distinguish messages from the authenticated user (typical when scanning "All Mail", which spans Sent). v1.0.0 default change: excludeSelf now defaults to true — set it to false to include the user's own outgoing mail in the table. Response also includes scanned/truncated indicators.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder | No | Folder to analyze (default: INBOX). Note: scanning `All Mail` includes Sent, so your own address can appear unless excludeSelf stays true. | INBOX |
| since | No | Only count messages on or after this date (`YYYY-MM-DD`, inclusive). Omit for no lower bound. | |
| before | No | Only count messages strictly before this date (`YYYY-MM-DD`, exclusive). Omit for no upper bound. | |
| limit | No | Max number of sender rows to return, 1–200 (default: 20). Rows are sorted by message count, descending. | |
| scanLimit | No | Max envelopes to scan when building the table, 1–20000 (default: 5000). The response reports if it was truncated; raise for large folders. | |
| excludeSelf | No | Drop rows whose address matches PROTONMAIL_USERNAME. Defaults to true (changed in v1.0.0). Set false to include your own outgoing address (e.g. when analyzing Sent or All Mail). |