Skip to main content
Glama

send_transactional_email

Send personalized transactional emails with recipient details, subject, and HTML body content using a Sitecore Send service for targeted communication.

Instructions

Send an email using transactional email service

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesHTML body of the email
subjectYesSubject of the email
toYesEmail of the recipient

Implementation Reference

  • Handler function that executes the tool logic: sends a transactional email using the SendClient's transactional.sendEmail method, handling success and error responses.
    execute: async ({ to, subject, body }) => { try { const result = await client.transactional.sendEmail({ Subject: subject, CampaignId: transactoinalConfog.campaignId!, Personalizations: [ { To: [ { Email: to, } ], } ], Content: [ { Value: body, Type: "text/html", }, ] }); return { content: [ { type: "text", text: `Email sent ${result.TotalAccepted > 0 ? "successfully" : "unsuccessfully"}` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } }
  • Zod schema defining the input parameters for the tool: recipient email (to), subject, and HTML body.
    parameters: z.object({ to: z.string().email().describe("Email of the recipient"), subject: z.string().describe("Subject of the email"), body: z.string().describe("HTML body of the email"), }),
  • Registers the 'send_transactional_email' tool with the FastMCP server inside the addApiTools function, conditional on campaignId being provided.
    name: "send_transactional_email", description: "Send an email using transactional email service", parameters: z.object({ to: z.string().email().describe("Email of the recipient"), subject: z.string().describe("Subject of the email"), body: z.string().describe("HTML body of the email"), }), annotations: { title: "Send an email using transactional email service", openWorldHint: true, }, execute: async ({ to, subject, body }) => { try { const result = await client.transactional.sendEmail({ Subject: subject, CampaignId: transactoinalConfog.campaignId!, Personalizations: [ { To: [ { Email: to, } ], } ], Content: [ { Value: body, Type: "text/html", }, ] }); return { content: [ { type: "text", text: `Email sent ${result.TotalAccepted > 0 ? "successfully" : "unsuccessfully"}` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } } });

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/izharikov/send-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server