fetch-attachment
Retrieve an email attachment's raw bytes as base64 by specifying message ID and attachment name. Access contents inline without saving a file.
Instructions
Use when: retrieving an attachment's raw bytes inline as base64 (by message id and attachmentName), e.g. to process its contents without keeping a file. Returns: the attachment's bytes base64-encoded, with its size and (for IMAP) MIME type. Do not use when: you don't know the attachment name (use list-attachments first) or you just want it saved to disk (use save-attachment). Safety: leaves no file behind, but the AppleScript path is not disk-free — Mail writes the attachment into a private temp directory, which is read back and then deleted. Needs no Full Disk Access either way: Mail performs that write under the Automation grant, and this server never reads the mail store itself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| attachmentName | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bytes | No | ||
| mimeType | No | ||
| contentBase64 | No | ||
| attachmentName | No |