Skip to main content
Glama
mailpace

MailPace MCP Server

Official
by mailpace

send-email

Send emails via MailPace MCP Server using JSON input for to, from, subject, and attachments. Simplify email delivery for transactional purposes with structured data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attachmentsNo
bccNo
ccNo
fromYes
htmlbodyNo
inreplytoNo
list_unsubscribeNo
referencesNo
replytoNo
subjectNo
tagsNo
textbodyNo
toYes

Implementation Reference

  • index.ts:47-89 (handler)
    The handler function for the 'send-email' tool. It validates that either textbody or htmlbody is provided, sends the email using the MailPace client, and returns a structured success or error response.
    async (params, _extra) => { try { if (!params.textbody && !params.htmlbody) { return { content: [{ type: "text", text: "Either text or html content must be provided" }], isError: true }; } // Send the email const result = await client.sendEmail(params); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: "Email sent successfully", data: { messageId: result.id, status: result.status } }, null, 2) } ] }; } catch (error: any) { console.error(`Error sending email: ${error.message}`); return { content: [ { type: "text", text: JSON.stringify({ success: false, message: "Failed to send email", error: error.message }, null, 2) } ], isError: true }; } }
  • Zod schema defining the input parameters for the 'send-email' tool, including from, to, subject, body options, CC/BCC, attachments, and tags.
    from: z.string().email(), to: z.string(), subject: z.string().optional(), htmlbody: z.string().optional(), textbody: z.string().optional(), cc: z.string().optional(), bcc: z.string().optional(), replyto: z.string().optional(), inreplyto: z.string().optional(), references: z.string().optional(), list_unsubscribe: z.string().optional(), attachments: z.array(z.object({ name: z.string(), content: z.string(), content_type: z.string(), cid: z.string().optional() })).optional(), tags: z.union([z.string(), z.array(z.string())]).optional() },
  • index.ts:25-90 (registration)
    Registration of the 'send-email' tool on the MCP server using server.tool(), including name, input schema, and handler function.
    server.tool( "send-email", { from: z.string().email(), to: z.string(), subject: z.string().optional(), htmlbody: z.string().optional(), textbody: z.string().optional(), cc: z.string().optional(), bcc: z.string().optional(), replyto: z.string().optional(), inreplyto: z.string().optional(), references: z.string().optional(), list_unsubscribe: z.string().optional(), attachments: z.array(z.object({ name: z.string(), content: z.string(), content_type: z.string(), cid: z.string().optional() })).optional(), tags: z.union([z.string(), z.array(z.string())]).optional() }, async (params, _extra) => { try { if (!params.textbody && !params.htmlbody) { return { content: [{ type: "text", text: "Either text or html content must be provided" }], isError: true }; } // Send the email const result = await client.sendEmail(params); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: "Email sent successfully", data: { messageId: result.id, status: result.status } }, null, 2) } ] }; } catch (error: any) { console.error(`Error sending email: ${error.message}`); return { content: [ { type: "text", text: JSON.stringify({ success: false, message: "Failed to send email", error: error.message }, null, 2) } ], isError: true }; } } );

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/mailpace/mailpace-mcp'

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