Skip to content

Instantly share code, notes, and snippets.

@leonid-shevtsov
Last active February 24, 2026 09:51
Show Gist options
  • Select an option

  • Save leonid-shevtsov/2c41917c14e8e134e88284520122bd5d to your computer and use it in GitHub Desktop.

Select an option

Save leonid-shevtsov/2c41917c14e8e134e88284520122bd5d to your computer and use it in GitHub Desktop.
Mailtrap skill for OpenClaw
name description metadata
email_sandbox
Send email via HTTP API. Use when the agent should send email to a recipient.
openclaw
requires primaryEnv
env
MAILTRAP_API_TOKEN
MAILTRAP_INBOX_ID
MAILTRAP_API_TOKEN

Send email

This skill lets the agent send email to recipients.

How to send email

Use the Exec tool to run curl against the email API. The API is:

  • Endpoint: POST https://sandbox.api.mailtrap.io/api/send/{inbox_id}
  • Auth: header Authorization: Bearer {MAILTRAP_API_TOKEN}
  • Body: JSON with from, to, subject, text; optional category, html, templates, etc. See Send email (including templates) | Mailtrap API for full parameters.

Important: The skill must be run through OpenClaw’s agent turn that injects skills.entries.email_sandbox.env, so MAILTRAP_API_TOKEN and MAILTRAP_INBOX_ID are set. Configure skills.entries.email_sandbox.env in ~/.openclaw/openclaw.json (see docs/openclaw-email-sandbox.example.json).

Request JSON shape:

  • from: { "email": "sender@example.com", "name": "Sender Name" } (name optional)
  • to: [{ "email": "recipient@example.com" }]
  • subject: string
  • text: string (plain body)
  • category: optional string (e.g. "Integration Test")
  • See Send email (including templates) for more fields (e.g. html, templates, attachments).

Example curl:

curl --location --request POST "https://sandbox.api.mailtrap.io/api/send/${MAILTRAP_INBOX_ID}" \
  --header "Authorization: Bearer ${MAILTRAP_API_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "User-Agent: OpenClaw" \
  --data-raw '{"from":{"email":"hello@example.com","name":"Mailtrap Test"},"to":[{"email":"recipient@example.com"}],"subject":"You are awesome!","text":"Congrats for sending test email with Mailtrap!","category":"Integration Test"}'

The agent should replace from, to, subject, and text with the actual values; category is optional. For bodies or subjects containing double quotes or newlines, build the JSON safely (e.g. with jq -n --arg from ... --arg to ... --arg subject ... --arg text ... '{from:{email:$from,name:"Agent"},to:[{email:$to}],subject:$subject,text:$text}' and pass it to curl -d @- or --data-raw @-).

On success the API returns HTTP 2xx and JSON like {"success":true,"message_ids":["..."]}. The message is delivered to the recipient.

Setup

Set skills.entries.email_sandbox.env in ~/.openclaw/openclaw.json to include MAILTRAP_API_TOKEN and MAILTRAP_INBOX_ID.

Optional: reading the latest email

A future version may add reading the latest received message via the API (e.g. for OTP or forwarded messages). Currently only sending is supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment