Create a Mail draft (saved, not sent) with subject + body and an
optional attachment. Uses Mail's AppleScript dictionary directly:
`make new outgoing message` then `save` (NOT `send`). The draft
appears in the Drafts mailbox of the default account.
This is the CORRECT path for any task that says "save as Mail
draft" / "share via Mail as draft". Common wrong path: agents
open a compose window with Cmd+N, type subject + body, then close
with Cmd+W — that prompts a Save sheet they often skip, losing
the draft. This skill bypasses the compose window entirely.
Create a Mail draft (saved, not sent) with subject + body and an
optional attachment. Uses Mail's AppleScript dictionary directly:
`make new outgoing message` then `save` (NOT `send`). The draft
appears in the Drafts mailbox of the default account.
This is the CORRECT path for any task that says "save as Mail
draft" / "share via Mail as draft". Common wrong path: agents
open a compose window with Cmd+N, type subject + body, then close
with Cmd+W — that prompts a Save sheet they often skip, losing
the draft. This skill bypasses the compose window entirely.
command
["sh","-c","SUBJECT=\"$1\"; BODY=\"$2\"; ATTACH=\"$3\"; TO=\"$4\"\n[ -z \"$SUBJECT\" ] && { echo \"subject required\" >&2; exit 1; }\n\n# Escape backslashes and double-quotes for AppleScript string literals.\nesc() { printf '%s' \"$1\" | /usr/bin/sed -e 's/\\\\/\\\\\\\\/g' -e 's/\"/\\\\\"/g'; }\nSUBJECT_E=\"$(esc \"$SUBJECT\")\"\nBODY_E=\"$(esc \"$BODY\")\"\nTO_E=\"$(esc \"$TO\")\"\n# ATTACH is a path — leave it as-is for POSIX file coercion\n\nosascript 2>&1 <<APPLE\ntell application \"Mail\"\n set newMsg to make new outgoing message with properties ¬\n {subject:\"$SUBJECT_E\", content:\"$BODY_E\", visible:false}\n if \"$TO_E\" is not \"\" then\n try\n tell newMsg to make new to recipient at end of to recipients ¬\n with properties {address:\"$TO_E\"}\n end try\n end if\n if \"$ATTACH\" is not \"\" then\n try\n tell newMsg to make new attachment ¬\n with properties {file name:(POSIX file \"$ATTACH\")}\n on error errMsg\n save newMsg\n return \"draft_saved_no_attach: \" & errMsg\n end try\n end if\n save newMsg\n return \"draft_saved\"\nend tell\nAPPLE\n","_"]
{"subject":{"type":"string","description":"Email subject line (required)","required":true},"body":{"type":"string","description":"Plain-text body of the email","required":false,"default":""},"attachment":{"type":"string","description":"Absolute POSIX path to a file to attach (optional)","required":false,"default":""},"to":{"type":"string","description":"Recipient email address (optional — drafts can have empty to)","required":false,"default":""}}
timeout
30
mail_draft — create + save a Mail draft (no send)
Wraps the canonical AppleScript Mail draft pattern. save commits
the message to the Drafts mailbox without sending. send is NEVER
called from this skill.