resend_send_email
Send emails to recipients with HTML or plain text content, CC/BCC support, reply-to addresses, and custom tracking tags for monitoring.
Instructions
Send a single email to one or more recipients. Supports HTML and plain text content, CC/BCC, reply-to, and custom tags for tracking.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient email address(es). Max 50 addresses. | |
| subject | Yes | Email subject line | |
| html | No | HTML version of the email body | |
| text | No | Plain text version. Auto-generated from HTML if omitted. | |
| cc | No | CC recipient(s) | |
| bcc | No | BCC recipient(s) | |
| reply_to | No | Reply-to email address(es) | |
| tags | No | Custom metadata tags for tracking (max 50) |
Implementation Reference
- src/index.ts:75-108 (handler)Handler for 'resend_send_email' tool: parses arguments with SendEmailRequestSchema, builds Resend email options, sends email, returns success with ID.case 'resend_send_email': { const args = SendEmailRequestSchema.parse(request.params.arguments); // Build email options - Resend requires html or text const emailOptions: Parameters<typeof resend.emails.send>[0] = { from: fromEmail, to: args.to, subject: args.subject, ...(args.html ? { html: args.html } : { text: args.text! }), ...(args.cc && { cc: args.cc }), ...(args.bcc && { bcc: args.bcc }), ...(args.reply_to && { replyTo: args.reply_to }), ...(args.tags && { tags: args.tags }), }; const { data, error } = await resend.emails.send(emailOptions); if (error) { throw new Error(`Failed to send email: ${error.message}`); } return { content: [ { type: 'text', text: JSON.stringify({ success: true, id: data?.id, message: 'Email sent successfully', }), }, ], }; }
- src/schemas.ts:18-50 (schema)Input schema (Zod) for the resend_send_email tool defining parameters like to, subject, html/text, cc, bcc, etc.export const SendEmailRequestSchema = z .object({ to: z .union([z.string().email(), z.array(z.string().email()).max(50)]) .describe('Recipient email address(es). Max 50 addresses.'), subject: z.string().describe('Email subject line'), html: z.string().optional().describe('HTML version of the email body'), text: z .string() .optional() .describe('Plain text version. Auto-generated from HTML if omitted.'), cc: z .union([z.string().email(), z.array(z.string().email())]) .optional() .describe('CC recipient(s)'), bcc: z .union([z.string().email(), z.array(z.string().email())]) .optional() .describe('BCC recipient(s)'), reply_to: z .union([z.string().email(), z.array(z.string().email())]) .optional() .describe('Reply-to email address(es)'), tags: z .array(TagSchema) .max(50) .optional() .describe('Custom metadata tags for tracking (max 50)'), }) .refine((data) => data.html || data.text, { message: 'Either html or text must be provided', path: ['html', 'text'], });
- src/index.ts:52-56 (registration)Tool registration in the MCP server: defines name, description, and inputSchema for listTools.{ name: 'resend_send_email', description: 'Send a single email to one or more recipients. Supports HTML and plain text content, CC/BCC, reply-to, and custom tags for tracking.', inputSchema: zodToJsonSchema(SendEmailRequestSchema),