Skip to main content
Glama

send_smtp_email

Send emails via SMTP protocol to deliver messages with specified recipients, subjects, and HTML content.

Instructions

Send an email using SMTP

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesEmail address to send the email to
subjectYesSubject of the email
bodyYesHTML body of the email

Implementation Reference

  • The execute handler for the send_smtp_email tool, which sends the email using the SMTP client and returns success or failure message.
    execute: async ({ to, subject, body }) => { const res = await client.sendMail({ from: config.from, to, subject, html: body, }); return { content: [{ type: "text", text: res.accepted.length > 0 ? "Email sent successfully." : "Email sending failed." }] } }
  • Zod schema defining the input parameters for the send_smtp_email tool: to, subject, body.
    parameters: z.object({ to: z.string().email().describe("Email address to send the email to"), subject: z.string().describe("Subject of the email"), body: z.string().describe("HTML body of the email"), }),
  • Registration of the send_smtp_email tool via server.addTool, including name, description, schema, annotations, and inline handler.
    server.addTool({ name: "send_smtp_email", description: "Send an email using SMTP", parameters: z.object({ to: z.string().email().describe("Email address to send the email to"), subject: z.string().describe("Subject of the email"), body: z.string().describe("HTML body of the email"), }), annotations: { title: "Send SMTP Email", openWorldHint: true, }, execute: async ({ to, subject, body }) => { const res = await client.sendMail({ from: config.from, to, subject, html: body, }); return { content: [{ type: "text", text: res.accepted.length > 0 ? "Email sent successfully." : "Email sending failed." }] } } });
  • Helper function to create the Nodemailer SMTP transport client used by the tool handler.
    export const createClient = (smtpConfig: SmtpConfig) => nodemailer.createTransport({ host: smtpConfig.host, port: smtpConfig.port, secure: smtpConfig.secure, auth: { user: smtpConfig.auth.user, pass: smtpConfig.auth.pass } });
  • src/tools/index.ts:7-7 (registration)
    Calls addSmptTools to register SMTP tools, invoked from the main tools aggregator.
    addSmptTools(server, config.smtp);

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