x402_send_email
Send transactional emails with HTML/plain text, CC/BCC recipients, and file attachments via Resend. Paid mode costs $0.01 USDC per email with daily limits, or use free test mode for fixture data.
Instructions
Send a transactional email via Resend. Price: $0.01 USDC per email (paid mode) | Free test: returns fixture data.
Supports plain text or HTML body, CC/BCC recipients, and file attachments (base64-encoded, max 25MB per file). Per-wallet daily limit: 10 emails. Per-domain daily limit: 5 emails (applies to all recipients including CC/BCC). Without X402_PRIVATE_KEY, only the free test endpoint is available.
Returns: message_id from Resend.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient email address | |
| subject | Yes | Email subject (max 998 chars) | |
| body | Yes | Email body — HTML or plain text (max 100 KB) | |
| reply_to | No | Optional reply-to address | |
| cc | No | CC recipients — list of email addresses | |
| bcc | No | BCC recipients — list of email addresses | |
| attachments | No | File attachments (base64-encoded, max 25MB pre-encoding per file) |
Implementation Reference
- src/index.ts:513-545 (handler)The handler for the x402_send_email tool, which handles both paid (via Resend) and free (test) email sending logic.
async (params) => { const base = APIS.email.baseUrl; try { const usePaid = !!PRIVATE_KEY; if (usePaid) { const payload: Record<string, unknown> = { to: params.to, subject: params.subject, body: params.body, }; if (params.reply_to) payload.reply_to = params.reply_to; if (params.cc) payload.cc = params.cc; if (params.bcc) payload.bcc = params.bcc; if (params.attachments) payload.attachments = params.attachments; const data = await apiPost(base, "/send", payload, true); return textResult({ mode: "paid", cost: "$0.01", ...data, }); } else { const data = await apiGet(base, "/send/test"); return textResult({ mode: "free_test", note: "Free test — no email actually sent. Set X402_PRIVATE_KEY for real email delivery.", ...data, }); } } catch (err: any) { return errorResult(err.message); - src/index.ts:485-512 (schema)The Zod schema validation for the input parameters of the x402_send_email tool.
{ to: z.string().email().describe("Recipient email address"), subject: z .string() .min(1) .max(998) .describe("Email subject (max 998 chars)"), body: z .string() .min(1) .max(102400) .describe("Email body — HTML or plain text (max 100 KB)"), reply_to: z .string() .email() .optional() .describe("Optional reply-to address"), cc: z.array(z.string().email()).optional() .describe("CC recipients — list of email addresses"), bcc: z.array(z.string().email()).optional() .describe("BCC recipients — list of email addresses"), attachments: z.array(z.object({ filename: z.string().describe("Filename including extension (e.g. 'report.pdf')"), content: z.string().describe("Base64-encoded file content (max 25MB decoded)"), content_type: z.string().optional() .describe("MIME type — auto-derived from filename if omitted"), })).optional().describe("File attachments (base64-encoded, max 25MB pre-encoding per file)"), }, - src/index.ts:476-476 (registration)Registration of the x402_send_email tool in the server instance.
"x402_send_email",