mailapp-send-email
npx machina-cli add skill IvanCampos/agents/mailapp-send-email --openclawMail.app Send Email
Overview
Use the bundled AppleScript to compose and optionally send Mail.app messages with structured inputs (to/cc/bcc/subject/body/attachments).
Quick Start
Run the AppleScript via osascript with --to, --subject, and --body. Pass comma-separated lists for multiple recipients or attachments.
osascript /Users/ivancampos/.codex/skills/mailapp-send-email/scripts/send_mail.applescript \
--to "test@test.com" \
--subject "hello" \
--body "testing"
Inputs
Use these flags. Only --to, --subject, and --body are required.
--tosingle email or comma-separated list--ccoptional comma-separated list--bccoptional comma-separated list--subjectsubject line--bodymessage body--attachoptional comma-separated POSIX file paths--sendoptionaltrue|false(defaulttrue, send immediately)
Behavior
- Create a new outgoing message in Mail.app.
- By default send immediately. If
--send false, leave the draft visible for review. - If
--attachis provided, add each file path as an attachment.
Troubleshooting
- If Mail.app automation prompts appear, grant permissions in System Settings -> Privacy & Security -> Automation.
- If attachments fail, ensure paths are absolute POSIX paths and the files exist.
Resources
scripts/
scripts/send_mail.applescriptCreate a Mail.app message with optional cc/bcc/attachments and optional immediate send.
Source
git clone https://github.com/IvanCampos/agents/blob/main/skills/mailapp-send-email/SKILL.mdView on GitHub Overview
Mail.app Send Email uses a bundled AppleScript to compose and optionally send messages in Apple Mail. It supports to, cc, bcc, subject, body and optional attachments, enabling automation from scripts.
How This Skill Works
Run the AppleScript via osascript and pass flags like --to, --subject and --body. The script creates a new outgoing Mail.app message and can attach files if --attach is provided; by default it sends immediately unless --send is false.
When to Use It
- Automating email sending from a macOS workflow or agent
- Sending to multiple recipients using to cc or bcc
- Including file attachments from POSIX paths
- Creating drafts for review by setting --send false
- Triggering Mail.app actions from scripts or OSAScript automation
Quick Start
- Step 1: Run the AppleScript via osascript with --to --subject and --body. Example: osascript /Users/ivancampos/.codex/skills/mailapp-send-email/scripts/send_mail.applescript --to "test@test.com" --subject "hello" --body "testing"
- Step 2: Pass comma separated lists for multiple recipients or attachments
- Step 3: Optionally include --attach and --send to control attachments and immediate sending
Best Practices
- Use absolute POSIX paths for attachments
- Test with --send false to review drafts
- Grant Mail automation permissions in System Settings
- Validate comma separated recipient lists for to cc and bcc
- Keep subject and body content clear and avoid problematic characters
Example Use Cases
- Send a welcome email to a new user with to and subject using osascript
- Attach a contract PDF located at /Users/me/Documents/Contract.pdf to the message
- Send to multiple recipients with CC and BCC in one go
- Create a draft for internal review by setting --send false
- Automatically send a daily status report as part of a macOS automation