draft
Compose and edit unsent emails in a mailbox folder, adding recipients, attachments, templates, and signatures without sending.
Instructions
Create or edit a draft in a Drafts folder. NOTHING IS SENT (use send_email for that).
New: to, subject, body (markdown). reply_to= answers the sender; reply_all= keeps everyone; forward= forwards it with its attachments. edit= changes an existing draft (fields you leave out stay as they are).
attach_from: attachment IDs from other emails (e.g. 'INBOX#1234#0') to attach.
New files (photos, PDFs, documents, audio, video, zip; programs are always refused): attach_path: file paths on the user's computer, e.g. ["~/Desktop/invoice.pdf"] (only when this server runs on that computer). attach_content: small files you wrote yourself, [{"name": "notes.txt", "text": "..."}] or [{"name": "chart.png", "base64": "..."}], up to 2 MB each. attach_upload: files the user put on the upload page, by file name (["Beach-day.jpg"]), ["latest"] for the newest ("the file I just uploaded"), or a code.
Some files are suspect (macros, scripts, archives that can't be checked): the draft is then NOT saved and you get the reasons. Tell the user, and only if they agree, call again with allow_suspect=true.
photos="hd" (default) sends photos as they are; photos="smaller" resizes new photos to at most 2560 px at high quality (use it when the user asks, or after they agree when files are over the size limit).
iPhone HEIC photos: the draft is NOT saved until the user chose: heic="jpg" (convert, location removed) or heic="keep". Ask them first.
template: name or number from templates; placeholder: ["name=value", ...] for its manual fields.
If a signature is set up (accounts says so), it is added automatically under the body: end the body with a short closing line (e.g. "Best,") and don't write the sender's name yourself. no_signature=true skips it.
delete= moves a draft to Trash (must be the only argument).
account: the mailbox address or name to write from (see accounts). Default: replies and forwards use the mailbox the email is in (or the first mailbox that may draft); new emails use the first mailbox.
mode="signatures" shows each mailbox's signature instead of drafting. mode="files" lists the files waiting on the upload page, so you can confirm with the user which one to attach.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | Copy addresses. | |
| to | No | Recipient addresses. | |
| bcc | No | Hidden copy addresses. | |
| body | No | The email text, in markdown. End it with a short closing line; the signature is added for you. | |
| edit | No | The ID of an existing draft to change. Fields you leave out stay as they are. | |
| heic | No | For iPhone HEIC photos, after asking the user: 'jpg' converts them (location removed), 'keep' sends them as they are. | |
| mode | No | 'signatures' shows each mailbox's signature, 'files' lists files waiting on the upload page. Nothing is drafted then. | |
| delete | No | The ID of a draft to move to Trash. Must be the only argument. | |
| photos | No | 'hd' sends photos as they are; 'smaller' resizes new photos to at most 2560 px. | hd |
| account | No | The mailbox address or name to write from. Empty: replies and forwards use the email's mailbox, new emails the first mailbox. | |
| forward | No | The ID of an email to forward, with its attachments. | |
| subject | No | The subject line. | |
| reply_to | No | The ID of an email to answer: replies to its sender. | |
| template | No | A template's name or number, from templates. | |
| reply_all | No | The ID of an email to answer: replies to everyone on it. | |
| attach_from | No | Attachment IDs from other emails to attach, like 'INBOX#1234#0'. | |
| attach_path | No | File paths on the user's computer to attach, like ['~/Desktop/invoice.pdf']. Only when this server runs on that computer. | |
| placeholder | No | Values for the template's manual fields, like ['name=Sam']. | |
| no_signature | No | true: don't add the mailbox's signature. | |
| allow_suspect | No | true: attach suspect files anyway. Only after the user agreed, once told the reasons. | |
| attach_upload | No | Files the user put on the upload page, by file name, ['latest'] for the newest, or a code. | |
| attach_content | No | Small files you wrote yourself, up to 2 MB each: [{'name': 'notes.txt', 'text': '...'}] or [{'name': 'chart.png', 'base64': '...'}]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |