send-email

from resend/resend-skills

Agent Skills for working with Resend to send and receive emails.

18 stars1 forksUpdated Jan 23, 2026
npx skills add https://github.com/resend/resend-skills --skill send-email

SKILL.md

Send Email with Resend

Overview

Resend provides two endpoints for sending emails:

ApproachEndpointUse Case
SinglePOST /emailsIndividual transactional emails, emails with attachments, scheduled sends
BatchPOST /emails/batchMultiple distinct emails in one request (max 100), bulk notifications

Choose batch when:

  • Sending 2+ distinct emails at once
  • Reducing API calls is important (by default, rate limit is 2 requests per second)
  • No attachments or scheduling needed

Choose single when:

  • Sending one email
  • Email needs attachments
  • Email needs to be scheduled
  • Different recipients need different timing

Quick Start

  1. Detect project language from config files (package.json, requirements.txt, go.mod, etc.)
  2. Install SDK (preferred) or use cURL - See references/installation.md
  3. Choose single or batch based on the decision matrix above
  4. Implement best practices - Idempotency keys, error handling, retries

Best Practices (Critical for Production)

Always implement these for production email sending. See references/best-practices.md for complete implementations.

Idempotency Keys

Prevent duplicate emails when retrying failed requests.

Key Facts
Format (single)<event-type>/<entity-id> (e.g., welcome-email/user-123)
Format (batch)batch-<event-type>/<batch-id> (e.g., batch-orders/batch-456)
Expiration24 hours
Max length256 characters
Duplicate payloadReturns original response without resending
Different payloadReturns 409 error

Error Handling

CodeAction
400, 422Fix request parameters, don't retry
401, 403Check API key / verify domain, don't retry
409Idempotency conflict - use new key or fix payload
429Rate limited - retry with exponential backoff (by default, rate limit is 2 requests/second)
500Server error - retry with exponential backoff

Retry Strategy

  • Backoff: Exponential (1s, 2s, 4s...)
  • Max retries: 3-5 for most use cases
  • Only retry: 429 (rate limit) and 500 (server error)
  • Always use: Idempotency keys when retrying

Single Email

Endpoint: POST /emails (prefer SDK over cURL)

Required Parameters

ParameterTypeDescription
fromstringSender address. Format: "Name <email@domain.com>"
tostring[]Recipient addresses (max 50)
subjectstringEmail subject line
html or textstringEmail body content

Optional Parameters

ParameterTypeDescription
ccstring[]CC recipients
bccstring[]BCC recipients
reply_to*string[]Reply-to addresses
scheduled_at*stringSchedule send time (ISO 8601)
attachmentsarrayFile attachments (max 40MB total)
tagsarrayKey/value pairs for tracking (see Tags)
headersobjectCustom headers

*Parameter naming varies by SDK (e.g., replyTo in Node.js, reply_to in Python).

Minimal Example (Node.js)

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send(
  {
    from: 'Acme <onboarding@resend.dev>',
    to: ['delivered@resend.dev'],
    subject: 'Hello World',
    html: '<p>Email body here</p>',
  },
  { idempotencyKey: `welcome-email/${userId}` }
);

if (error) {
  console.error('Failed:', error.message);
  return;
}
console.log('Sent:', data.id);

See references/single-email-examples.md for all SDK implementations with error handling and retry logic.

Batch Email

Endpoint: POST /emails/batch (but prefer SDK over cURL)

Limitations

  • No attachments - Use single sends for emails with attachments
  • No scheduling - Use single sends for scheduled emails
  • Atomic - If one email fails validation, the entire batch fails
  • Max 100 emails per request
  • Max 50 recipients per individual email in the batch

Pre-validation

Since the entire batch fails on any validation error, validate all emails before sending:

  • Check required fields (from, to, subject, html/text)
  • Validate email formats
  • Ensure batch size <= 100

Minimal Example (Node.js)

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.batch.send(
  [
    {
      from: 'Acme <notifications@acme.com>',
      to: ['delivered@resend.dev'],
      subject: 'Order Shipped',
      html: '<p>Your order has shipped!</p>',
    },
    {
      from: 'Acme <notifications@acme.com>',
      to: ['delivered@resend.dev'],
      subject: 'Order Confirmed',
      html: '<p>Your order 

...
Read full content

Repository Stats

Stars18
Forks1
LicenseMIT License