nworks_mail_send
Send emails through NAVER WORKS platform using OAuth authentication. Specify recipients, subject, and body to dispatch messages asynchronously with 202 success confirmation.
Instructions
NAVER WORKS 메일을 전송합니다. '메일 보내줘', '이메일 작성해줘' 등의 요청에 사용. 비동기 전송(성공 시 202). User OAuth 인증 필요 (mail scope)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | 수신자 이메일 (여러 명은 ; 로 구분) | |
| subject | Yes | 메일 제목 | |
| body | No | 메일 본문 | |
| cc | No | 참조 이메일 (여러 명은 ; 로 구분) | |
| bcc | No | 숨은참조 이메일 (여러 명은 ; 로 구분) | |
| contentType | No | 본문 형식 (기본: html) | |
| userId | No | 발신자 ID (미지정 시 me) |
Implementation Reference
- src/api/mail.ts:96-130 (handler)The implementation of the sendMail function which calls the NAVER WORKS API to send an email.
export async function sendMail(opts: SendMailOptions): Promise<void> { const userId = opts.userId ?? "me"; const profile = opts.profile ?? "default"; const url = `${BASE_URL}/users/${sanitizePathSegment(userId)}/mail`; if (process.env["NWORKS_VERBOSE"] === "1") { console.error(`[nworks] POST ${url}`); } const body: Record<string, unknown> = { to: opts.to, subject: opts.subject, }; if (opts.body !== undefined) body.body = opts.body; if (opts.cc) body.cc = opts.cc; if (opts.bcc) body.bcc = opts.bcc; if (opts.contentType) body.contentType = opts.contentType; const res = await authedFetch( url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), }, profile ); if (res.status === 202) return; if (!res.ok) return handleError(res); } export async function listMails( folderId = 0, - src/mcp/tools.ts:521-546 (registration)The MCP tool registration for 'nworks_mail_send', which delegates the request to 'mailApi.sendMail'.
server.tool( "nworks_mail_send", "NAVER WORKS 메일을 전송합니다. '메일 보내줘', '이메일 작성해줘' 등의 요청에 사용. 비동기 전송(성공 시 202). User OAuth 인증 필요 (mail scope)", { to: z.string().describe("수신자 이메일 (여러 명은 ; 로 구분)"), subject: z.string().describe("메일 제목"), body: z.string().optional().describe("메일 본문"), cc: z.string().optional().describe("참조 이메일 (여러 명은 ; 로 구분)"), bcc: z.string().optional().describe("숨은참조 이메일 (여러 명은 ; 로 구분)"), contentType: z.enum(["html", "text"]).optional().describe("본문 형식 (기본: html)"), userId: z.string().optional().describe("발신자 ID (미지정 시 me)"), }, async ({ to, subject, body, cc, bcc, contentType, userId }) => { try { await mailApi.sendMail({ to, subject, body, cc, bcc, contentType, userId: userId ?? "me", }); return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, message: "메일이 전송되었습니다 (비동기 처리)" }) }], };