R

resend

by @resendv
4.5(20)

掌握使用Resend发送和接收邮件的代理技能,通过智能自动化提升邮件营销效率和用户沟通体验。

resend-(email-api)email-marketingtransactional-emailapi-integrationmarketing-automationGitHub
安装方式
npx skills add resend/resend-skills --skill resend
compare_arrows

Before / After 效果对比

1
使用前

传统的邮件营销和用户沟通,往往需要人工编写和发送邮件,效率低下且难以个性化,导致用户体验不佳,营销效果难以最大化。

使用后

掌握Resend代理技能并结合智能自动化,能够实现邮件的智能发送与接收,大幅提升邮件营销的效率和个性化水平,优化用户沟通体验。

SKILL.md

Resend

Quick Send — 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);

Key gotcha: The Resend Node.js SDK does NOT throw exceptions — it returns { data, error }. Always check error explicitly instead of using try/catch for API errors.

Quick Send — Python

import resend
import os

resend.api_key = os.environ["RESEND_API_KEY"]

email = resend.Emails.send({
    "from": "Acme <onboarding@resend.dev>",
    "to": ["delivered@resend.dev"],
    "subject": "Hello World",
    "html": "<p>Email body here</p>",
}, idempotency_key=f"welcome-email/{user_id}")

Single vs Batch Decision

ChooseWhen
Single (POST /emails)1 email, needs attachments, needs scheduling
Batch (POST /emails/batch)2-100 distinct emails, no attachments, no scheduling

Batch is atomic — if one email fails validation, the entire batch fails. Always validate before sending. Batch does NOT support attachments or scheduled_at.

Idempotency Keys (Critical for Retries)

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
Same key + same payloadReturns original response without resending
Same key + different payloadReturns 409 error

Quick Receive (Node.js)

import { Resend } from 'resend';

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

export async function POST(req: Request) {
  const payload = await req.text(); // Must use raw text, not req.json()

  const event = resend.webhooks.verify({
    payload,
    headers: {
      'svix-id': req.headers.get('svix-id'),
      'svix-timestamp': req.headers.get('svix-timestamp'),
      'svix-signature': req.headers.get('svix-signature'),
    },
    secret: process.env.RESEND_WEBHOOK_SECRET,
  });

  if (event.type === 'email.received') {
    // Webhook has metadata only — call API for body
    const { data: email } = await resend.emails.receiving.get(
      event.data.email_id
    );
    console.log(email.text);
  }

  return new Response('OK', { status: 200 });
}

Key gotcha: Webhook payloads do NOT contain the email body. You must call resend.emails.receiving.get() separately.

What Do You Need?

TaskReference
Send a single emailsending/overview.md — parameters, deliverability, testing
Send batch emailssending/overview.mdsending/batch-email-examples.md
Full SDK examples (Node.js, Python, Go, cURL)sending/single-email-examples.md
Idempotency, retries, error handlingsending/best-practices.md
Receive inbound emailsreceiving.md — domain setup, webhooks, attachments
Manage templates (CRUD, variables)templates.md — lifecycle, aliases, pagination
Set up webhooks (all event types)webhooks.md — verification, retry schedule, IP allowlist
Install SDK (8+ languages)installation.md
Set up an AI agent inboxInstall the agent-email-inbox skill — covers security levels for untrusted input
Marketing emails / newslettersUse Resend Broadcasts — not batch sending

SDK Version Requirements

Always install the latest SDK version. These are the minimum versions for full functionality (sending, receiving, webhook verification):

LanguagePackageMin VersionInstall
Node.jsresend>= 6.9.2npm install resend
Pythonresend>= 2.21.0pip install resend
Goresend-go/v3>= 3.1.0go get github.com/resend/resend-go/v3
Rubyresend>= 1.0.0gem install resend
PHPresend/resend-php>= 1.1.0composer require resend/resend-php
Rustresend-rs>= 0.20.0cargo add resend-rs
Javaresend-java>= 4.11.0See installation.md
.NETResend>= 0.2.1dotnet add package Resend

If the project already has a Resend SDK installed, check the version and upgrade if it's below the minimum. Older SDKs may be missing webhooks.verify() or emails.receiving.get().

See installation.md for full installation commands, language detection, and cURL fallback.

Common Setup

API Key

Store in environment variable — never hardcode:

export RESEND_API_KEY=re_xxxxxxxxx

Get your key at resend.com/api-keys.

Detect Project Language

Check for these files: package.json (Node.js), requirements.txt/pyproject.toml (Python), go.mod (Go), Gemfile (Ruby), composer.json (PHP), Cargo.toml (Rust), pom.xml/build.gradle (Java), *.csproj (.NET).

Common Mistakes

#MistakeFix
1Retrying without idempotency keyAlways include idempotency key — prevents duplicate sends on retry. Format: <event-type>/<entity-id>
2Not verifying webhook signaturesAlways verify with resend.webhooks.verify() — unverified events can't be trusted
3Template variable name mismatchVariable names are case-sensitive — must match the template definition exactly. Use triple mustache {{{VAR}}} syntax
4Expecting email body in webhook payloadWebhooks contain metadata only — call resend.emails.receiving.get() for body content
5Using try/catch for Node.js SDK errorsSDK returns { data, error } — check error explicitly, don't wrap in try/catch
6Using batch for emails with attachmentsBatch doesn't support attachments — use single sends instead
7Testing with fake emails (test@gmail.com)Use delivered@resend.dev — fake addresses bounce and hurt reputation
8Sending with draft templateTemplates must be published before sending — call .publish() first
9html + template in same send callMutually exclusive — remove html/text/react when using template
10MX record not lowest priority for inboundEnsure Resend's MX has the lowest number (highest priority) or emails won't route

Cross-Cutting Concerns

Send + Receive Together

Auto-replies, email forwarding, or any receive-then-send workflow requires both capabilities:

  1. Set up inbound domain first (see receiving.md)
  2. Set up sending (see sending/overview.md)
  3. Note: batch sending does NOT support attachments or scheduling — use single sends when forwarding with attachments

AI Agent Inbox

If your system processes untrusted email content and takes actions (refunds, database changes, forwarding), install the agent-email-inbox skill. This applies whether or not AI is involved — any system interpreting freeform email content from external senders needs security measures.

Marketing Emails

The sending capabilities in this skill are for transactional email (receipts, confirmations, notifications). For marketing campaigns to large subscriber lists with unsubscribe links and engagement tracking, use Resend Broadcasts.

Domain Warm-up

New domains must gradually increase sending volume. Day 1 limit: ~150 emails (new domain) or ~1,000 (existing domain). See the warm-up schedule in sending/overview.md.

Testing

Never test with fake addresses at real email providers (test@gmail.com, fake@outlook.com) — they bounce and destroy sender reputation.

AddressResult
delivered@resend.devSimulates successful delivery
bounced@resend.devSimulates hard bounce
complained@resend.devSimulates spam complaint

Suppression List

Resend automatically suppresses hard-bounced and spam-complained addresses. Sending to suppressed addresses fires the email.suppressed webhook event instead of attempting delivery. Manage in Dashboard → Suppressions.

Webhook Event Types

EventTrigger
email.sentAPI request successful
email.deliveredReached recipient's mail server
email.bouncedPermanently rejected (hard bounce)
email.complainedRecipient marked as spam
email.opened / email.clickedRecipient engagement
email.delivery_delayedSoft bounce, Resend retries
email.receivedInbound email arrived
domain.* / contact.*Domain/contact changes

See webhooks.md for full details, signature verification, and retry schedule.

Error Handling Quick Reference

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 (default rate limit: 2 req/s)
500Server error — retry with exponential backoff

Resources

用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价

统计数据

安装量8.2K
评分4.5 / 5.0
版本
更新日期2026年5月23日
对比案例1 组

用户评分

4.5(20)
5
35%
4
50%
3
15%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

时间线

创建2026年3月17日
最后更新2026年5月23日