send_email
Send emails via the Blastengine API by specifying recipient, sender, subject, and body. Simplify email communication directly from your application or workflow.
Instructions
Send an email using Blastengine API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | Sender email address | |
| subject | Yes | Email subject | |
| text | Yes | Email body | |
| to | Yes | Recipient email address |
Implementation Reference
- server.js:56-96 (handler)The handler function for the 'send_email' tool, which uses BlastEngine to send emails based on input parameters.case "send_email": { const to = String(request.params.arguments?.to); const from = String(request.params.arguments?.from); const subject = String(request.params.arguments?.subject); const text = String(request.params.arguments?.text); if (!to || !from || !subject || !text) { throw new Error("宛先、送信元、件名、本文は必須です。"); } try { // BlastEngineクライアントの初期化 const client = new BlastEngine(process.env.BLASTENGINE_USER_ID, process.env.BLASTENGINE_API_KEY); // メールの送信 const transaction = new Transaction; transaction .setFrom(from) .setSubject(subject) .setTo(to) .setText(text); const res = await transaction.send(); return { content: [{ type: "text", text: `${to} にメールを送信しました。 delivery_id: ${res.delivery_id}` }], }; } catch (error) { console.error("メール送信エラー:", error); return { content: [ { type: "text", text: `${to} へのメール送信に失敗しました: ${error.message}`, }, ], isError: true, }; } }
- server.js:27-48 (schema)Input schema defining the parameters for the 'send_email' tool.inputSchema: { type: "object", properties: { to: { type: "string", description: "Recipient email address" }, from: { type: "string", description: "Sender email address" }, subject: { type: "string", description: "Email subject" }, text: { type: "string", description: "Email body" } }, required: ["to", "from", "subject", "text"] }
- server.js:24-50 (registration)Registration of the 'send_email' tool in the ListToolsRequestSchema response.{ name: "send_email", description: "Send an email using Blastengine API", inputSchema: { type: "object", properties: { to: { type: "string", description: "Recipient email address" }, from: { type: "string", description: "Sender email address" }, subject: { type: "string", description: "Email subject" }, text: { type: "string", description: "Email body" } }, required: ["to", "from", "subject", "text"] } } ]