From Sendmux
Guides selection of the cheapest Sendmux surface (MCP, CLI, SDK, or HTTP) for email API tasks to minimize token cost and round trips. Covers batch operations, cursor pagination, ETags, and conditional requests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sendmux:sendmux-token-efficient-usageThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill to choose the lowest-cost Sendmux route that still answers the task correctly.
Use this skill to choose the lowest-cost Sendmux route that still answers the task correctly.
smx_mbx_* keys or owner-approved Sending-resource smx_agent_* tokens for Sending calls, and smx_mbx_* keys for normal Mailbox calls.smx_agent_* only for the calls its scopes and resource allow. Pre-claim agent tokens cannot send.smx_root_* for Management calls.sendmux-attachments; prefer file_path, presigned URLs, CLI --attach, or SDK file helpers. Mailbox uploads cap each attachment at 7,500,000 bytes; Sending uploads cap each file at 18 MiB; MCP inline base64 caps at 32 KiB decoded.| Situation | Use | Why |
|---|---|---|
| Connected agent and curated tool exists | MCP tool | Small schema and no SDK boilerplate. |
| One-off terminal task | sendmux CLI with --json | Direct, scriptable, exposes the full generated operation set. |
| Application code or repeated workflow | SDK for the project already in use | Reuses client setup, pagination, headers, and retry helpers. |
| MCP lacks the needed operation | CLI for terminal work, SDK for code | Do not invent uncurated MCP tools. |
| No package/tooling available | Direct HTTP | Keep request bodies and headers aligned to OpenAPI. |
| Task | Cheapest correct default |
|---|---|
| Send one outbound email | sending_send_email, CLI sending:send, SDK sendingSendEmail; include Idempotency-Key. |
| Send multiple outbound emails | sending_send_email_batch, CLI sending:send:batch, SDK sendingSendEmailBatch; do not loop single sends. |
| Send or read attachments | sendmux-attachments; use file_path, presigned upload/download URLs, CLI --attach, SDK file helpers, blob_id for mailbox sends, and attachment_id for Sending sends instead of inline base64. |
| Count matching mailbox messages | mailbox_count_messages, CLI mailbox:count-messages, SDK mailboxCountMessages. |
| Search mailbox text | mailbox_search_message_snippets, CLI mailbox:search-message-snippets, SDK mailboxSearchMessageSnippets; then fetch selected IDs. |
| Read several known messages | mailbox_batch_get_messages, CLI mailbox:batch-get-messages, SDK mailboxBatchGetMessages. |
| Update/delete several messages | Batch update/delete after explicit confirmation. |
| Resume broad mailbox sync | mailbox_get_changes, CLI mailbox:get-changes, SDK mailboxGetChanges. |
| Resume filtered mailbox sync | CLI/SDK mailbox:query-message-changes / mailboxQueryMessageChanges; MCP does not curate it yet. |
| Watch live mailbox events | CLI/SDK mailbox:stream-events / mailboxStreamEvents; MCP does not curate it yet. |
| Scan threads | List threads, then fetch one thread or its messages. |
| Manage domains/mailboxes/keys | Management MCP for curated create/list/get/update/suspend/resume/key tools; CLI/SDK for uncovered lifecycle work. |
| Manage sending accounts | CLI/SDK; MCP does not curate provider tools yet. |
| Manage webhooks | MCP for list/create/test; CLI/SDK for get/update/delete/rotate/delivery payloads. |
| Inspect spend, logs, metrics | Summary/metrics first; filter log lists with small limit, then fetch one selected row. |
For mailbox questions, reduce the result set before reading content:
limit when the user needs examples.CLI:
sendmux mailbox:count-messages \
--query q=invoice \
--query is_unread=true \
--json
sendmux mailbox:search-message-snippets \
--query q=invoice \
--query is_unread=true \
--query limit=10 \
--json
sendmux mailbox:batch-get-messages \
--body '{
"ids": ["eml_abc", "eml_def"],
"body_mode": "clean_json",
"max_body_chars": 4000,
"strip_quotes": true,
"strip_signature": true,
"include_attachments": "metadata"
}' \
--json
Batch when there is more than one target.
sendmux sending:send:batch \
--idempotency-key "$IDEMPOTENCY_KEY" \
--body-file ./messages.json \
--json
sendmux mailbox:batch-update-messages \
--body '{
"ids": ["eml_abc", "eml_def"],
"seen": true,
"if_in_state": "state_from_prior_read"
}' \
--json
For batch sends, inspect every per-message result before reporting success. Batch can contain mixed outcomes.
Use sync endpoints instead of re-listing stable data.
Broad mailbox sync:
sendmux mailbox:get-changes \
--query messages_since_state="$MESSAGES_STATE" \
--query folders_since_state="$FOLDERS_STATE" \
--query threads_since_state="$THREADS_STATE" \
--query limit=100 \
--json
Filtered message sync:
sendmux mailbox:query-message-changes \
--query since_query_state="$QUERY_STATE" \
--query q=invoice \
--query is_unread=true \
--query limit=100 \
--json
Store the returned state token. Continue with the same filters only while has_more is true and the next page is needed.
limit values on list calls.pagination.next_cursor only until enough evidence has been gathered.If-None-Match for repeated detail reads that previously returned an ETag.If-Match for updates when the prior read returned an ETag.download_url; if it expires, re-fetch metadata instead of building URLs manually.CLI conditional examples:
sendmux management:get-email-log \
--path public_id=dlog_abc \
--if-none-match "$ETAG" \
--json
sendmux management:update-mailbox \
--path public_id=mbx_abc \
--if-match "$ETAG" \
--body '{"display_name":"Agent Inbox"}' \
--json
SDK helpers:
import {
conditionalHeaders,
idempotencyHeaders,
paginate,
responseEtag,
} from "@sendmux/core";
const headers = conditionalHeaders({ ifNoneMatch: priorEtag });
const writeHeaders = {
...conditionalHeaders({ etag: priorEtag }),
...idempotencyHeaders(operationKey),
};
Use Idempotency-Key on supported mutations so retrying does not create duplicate work.
Good candidates:
sending:send and sending:send:batch.mailbox:send-message.When retrying application code, prefer SDK retry helpers only for safe reads or idempotent writes. Non-idempotent writes should fail rather than risk duplicate side effects.
sendmux-getting-started.sendmux-send-email.sendmux-attachments.sendmux-mailbox-agent.sendmux-management.sendmux-cli.sendmux-mcp-setup.npx claudepluginhub sendmux/skills --plugin sendmuxReads, searches, counts, syncs, triages, files, deletes, threads, and replies to messages in a single Sendmux mailbox using an smx_mbx_ key or scoped smx_agent_ token.
Automates Mailersend email operations via Rube MCP (Composio). Handles tool discovery, connection setup, and execution of email workflows.
Integrates Resend email service via MCP protocol for AI agents. Sends transactional and marketing emails, configures sender verification, and automates workflows from Claude Desktop, GitHub Copilot, and Cursor.