imap_download_attachment
Download a specific email attachment by UID and filename. Images appear inline; PDFs and other files save to the configured directory.
Instructions
Download a single attachment from an email (folder + uid + attachment filename/contentId, as listed by imap_get_email). Images are returned inline for viewing; PDFs and other files are saved only inside the configured download directory. Use when the user wants the actual file contents, not just the message body.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | Email UID | |
| folder | No | Folder name | INBOX |
| filename | Yes | Attachment filename or contentId | |
| savePath | No | Optional root-relative path, or absolute path already inside the configured download directory. Outside paths are rejected. | |
| accountId | No | Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured. | |
| accountName | No | Account name instead of accountId. Optional if accountId is given or only one account is configured. | |
| extractText | No | For PDFs, extract and return text content inline |