send_email
Send emails using markdown formatting that automatically converts to HTML. Includes oversight features for review and approval when required.
Instructions
Send an email from your MultiMail address. The body is written in markdown and automatically converted to formatted HTML for delivery. If the mailbox is in read_only mode, this returns a 403 error with upgrade instructions — use request-upgrade to ask the operator for more autonomy. If the mailbox uses gated oversight, the response status will be 'pending_approval' — this means the email is queued for human review. Do not retry or resend when you see pending_approval.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient email addresses | |
| subject | Yes | Email subject line | |
| markdown | Yes | Email body in markdown format | |
| cc | No | CC email addresses | |
| mailbox_id | No | Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided) |
Implementation Reference
- src/index.ts:100-118 (handler)Complete send_email tool implementation including registration, schema definition, and handler function. The handler validates the mailbox_id, constructs the request body with to, subject, markdown, and optional cc fields, then calls the MultiMail API to send the email.
// Tool 2: send_email server.tool( "send_email", "Send an email from your MultiMail address. The body is written in markdown and automatically converted to formatted HTML for delivery. If the mailbox is in read_only mode, this returns a 403 error with upgrade instructions — use request-upgrade to ask the operator for more autonomy. If the mailbox uses gated oversight, the response status will be 'pending_approval' — this means the email is queued for human review. Do not retry or resend when you see pending_approval.", { to: z.array(z.string().email()).describe("Recipient email addresses"), subject: z.string().describe("Email subject line"), markdown: z.string().describe("Email body in markdown format"), cc: z.array(z.string().email()).optional().describe("CC email addresses"), mailbox_id: z.string().optional().describe("Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided)"), }, async ({ to, subject, markdown, cc, mailbox_id }) => { const id = getMailboxId(mailbox_id); const body: Record<string, unknown> = { to, subject, markdown }; if (cc?.length) body.cc = cc; const data = await apiCall("POST", `/v1/mailboxes/${encodeURIComponent(id)}/send`, body); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:104-110 (schema)Zod schema definition for send_email tool parameters: to (required array of emails), subject (required string), markdown (required string), cc (optional array of emails), and mailbox_id (optional string).
{ to: z.array(z.string().email()).describe("Recipient email addresses"), subject: z.string().describe("Email subject line"), markdown: z.string().describe("Email body in markdown format"), cc: z.array(z.string().email()).optional().describe("CC email addresses"), mailbox_id: z.string().optional().describe("Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided)"), }, - src/index.ts:111-117 (handler)The actual handler function for send_email that retrieves the mailbox_id, builds the request body, and makes a POST API call to /v1/mailboxes/{id}/send endpoint.
async ({ to, subject, markdown, cc, mailbox_id }) => { const id = getMailboxId(mailbox_id); const body: Record<string, unknown> = { to, subject, markdown }; if (cc?.length) body.cc = cc; const data = await apiCall("POST", `/v1/mailboxes/${encodeURIComponent(id)}/send`, body); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }