Skip to main content
Glama

send_email

Send emails through iCloud Mail to recipients with subject and text or HTML content. Use this tool to compose and deliver messages directly from your workflow.

Instructions

Send an email through iCloud Mail

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
htmlNoHTML email body
subjectYesEmail subject
textNoPlain text email body
toYesRecipient email address(es)

Implementation Reference

  • Core handler function that executes the email sending logic using nodemailer Transporter via iCloud SMTP.
    async sendEmail(options: SendEmailOptions): Promise<{ messageId: string }> { const mailOptions: nodemailer.SendMailOptions = { from: this.config.email, to: options.to, subject: options.subject, }; if (options.text) { mailOptions.text = options.text; } if (options.html) { mailOptions.html = options.html; } if (options.attachments) { mailOptions.attachments = options.attachments.map((att) => ({ filename: att.filename, path: att.path, content: att.content, contentType: att.contentType, })); } const info = await this.transporter.sendMail(mailOptions); return { messageId: info.messageId }; }
  • MCP server request handler that processes 'send_email' tool calls and delegates to iCloudMailClient.sendEmail.
    case 'send_email': { if (!mailClient) { throw new McpError( ErrorCode.InvalidRequest, 'iCloud Mail not configured. Please set ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables.' ); } const result = await mailClient.sendEmail({ to: args?.to as string | string[], subject: args?.subject as string, text: args?.text as string, html: args?.html as string, }); return { content: [ { type: 'text', text: `Email sent successfully. Message ID: ${result.messageId}`, }, ], }; }
  • src/index.ts:81-109 (registration)
    Registers the 'send_email' tool in the MCP ListTools response with name, description, and input schema.
    { name: 'send_email', description: 'Send an email through iCloud Mail', inputSchema: { type: 'object', properties: { to: { oneOf: [ { type: 'string' }, { type: 'array', items: { type: 'string' } }, ], description: 'Recipient email address(es)', }, subject: { type: 'string', description: 'Email subject', }, text: { type: 'string', description: 'Plain text email body', }, html: { type: 'string', description: 'HTML email body', }, }, required: ['to', 'subject'], }, },
  • TypeScript interface defining the input parameters for the sendEmail function.
    export interface SendEmailOptions { to: string | string[]; subject: string; text?: string; html?: string; attachments?: Array<{ filename: string; path?: string; content?: Buffer; contentType?: string; }>; }

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/Racimy/iMail-mcp'

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