Skip to main content
Glama

send_email

Send emails through Hiworks Mail MCP server with support for text, HTML content, attachments, CC, and BCC recipients.

Instructions

하이웍스 이메일을 전송합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameNo
passwordNo
toYes
subjectYes
textNo
htmlNo
ccNo
bccNo
attachmentsNo

Implementation Reference

  • The main execution logic for the send_email tool. Creates an SMTP transporter using the provided credentials and sends the email with nodemailer, returning success or error response.
    async ({ username, password, to, subject, text, html, cc, bcc, attachments }) => { try { log('Creating SMTP transporter...'); const transporter = await createSMTPTransporter(username, password); const mailOptions = { from: username, to, subject, text, html, cc, bcc, attachments }; log('Sending email...'); const info = await transporter.sendMail(mailOptions); log('Email sent successfully:', info.messageId); return { content: [ { type: "text", text: JSON.stringify({ success: true, messageId: info.messageId } as SendEmailResponse) } ] }; } catch (error: any) { log('Error sending email:', error); return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message } as SendEmailResponse) } ] }; } } ); // 메인 함수 async function main() {
  • src/index.ts:307-373 (registration)
    Registration of the send_email tool on the MCP server, specifying name, description, Zod input schema, and handler function.
    server.tool( 'send_email', '하이웍스 이메일을 전송합니다.', { ...emailSchema, to: z.string(), subject: z.string(), text: z.string().optional(), html: z.string().optional(), cc: z.array(z.string()).optional(), bcc: z.array(z.string()).optional(), attachments: z.array(z.object({ filename: z.string(), content: z.union([z.string(), z.instanceof(Buffer)]) })).optional() }, async ({ username, password, to, subject, text, html, cc, bcc, attachments }) => { try { log('Creating SMTP transporter...'); const transporter = await createSMTPTransporter(username, password); const mailOptions = { from: username, to, subject, text, html, cc, bcc, attachments }; log('Sending email...'); const info = await transporter.sendMail(mailOptions); log('Email sent successfully:', info.messageId); return { content: [ { type: "text", text: JSON.stringify({ success: true, messageId: info.messageId } as SendEmailResponse) } ] }; } catch (error: any) { log('Error sending email:', error); return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message } as SendEmailResponse) } ] }; } } ); // 메인 함수 async function main() { if (process.env.NODE_ENV === 'development') {
  • TypeScript interfaces defining the input (SendEmailParams) and output (SendEmailResponse) types for the send_email tool, imported and used in index.ts.
    export interface SendEmailParams { username?: string; password?: string; to: string; subject: string; text?: string; html?: string; cc?: string[]; bcc?: string[]; attachments?: Array<{ filename: string; content: string | Buffer; }>; } export interface SendEmailResponse { success: boolean; messageId?: string; error?: string; }
  • Helper function to create a nodemailer SMTP transporter configured for Hiworks SMTP server using the provided username and password.
    async function createSMTPTransporter(username: string, password: string) { return nodemailer.createTransport({ host: config.smtp.host, port: config.smtp.port, secure: config.smtp.secure, auth: { user: username, pass: password } }); }

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/beylessai/hiworks-mcp'

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