Save an attachment to a file
save_attachmentSaves one email attachment as a new file in an allowed folder (max 25 MiB) without changing the mailbox; use to keep a file or when reading is refused.
Instructions
Save one attachment as a new file in the allowed folder, at most 25 MiB; nothing in the mailbox changes.
Use it when the user wants to keep a file, or for a file read_attachment refuses. To put an attachment in a draft, create_draft's attachments_from copies it directly, though a saved filename also works in attachments. Take attachment, the index, from list_attachments. It needs no preview.
The only place it can write is the folder in PROTON_MCP_ATTACHMENTS_DIR, by default a private per-user folder. An existing file is never overwritten: each call writes a new file, and the result's filename says the name used. The file is private to this user and not executable; removing it is manual.
Returns saved, filename, index, type, size and sha256. Refuses a file over 25 MiB, a filename that is not one plain name, or an allowed folder that cannot be used.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | No | One plain file name; by default the sender's cleaned name. | |
| attachment | Yes | The attachment's index from list_attachments, counted from 1. | |
| message_id | Yes | The message's RFC Message-ID, as search_mail returns it, such as <a@example.test>. Not an IMAP UID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||