resend/resend-skills/agent-email-inbox

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention "agent" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.

Install

npx vskill@latest install resend/resend-skills/agent-email-inbox

SKILL.md

AI Agent Email Inbox

Overview

This skill covers setting up a secure email inbox that allows your application or AI agent to receive and respond to emails, with content safety measures in place.

Core principle: An AI agent's inbox receives untrusted input. Security configuration is important to handle this safely.

The skill builds the agent on a Resend Inbox. An inbox groups email into threads, and your agent replies inside the thread with one call. Resend sets the recipients and the threading headers. If the user has no custom domain, or their plan has no inbox available, use Receiving without an inbox instead. The security levels are the same for both.

Why Webhook-Based Receiving?

Resend uses webhooks for inbound email, meaning your agent is notified instantly when an email arrives. This is valuable for agents because:

  • Real-time responsiveness — React to emails within seconds, not minutes
  • No polling overhead — No cron jobs checking "any new mail?" repeatedly
  • Event-driven architecture — Your agent only wakes up when there's actually something to process
  • Lower API costs — No wasted calls checking empty inboxes

Architecture

Sender → Email → Resend Inbox → inbox.email.received webhook → Your Server → AI Agent
↓
Security Validation
↓
Process or Reject → Reply in the thread

SDK Version Requirements

The inbox flow needs the Node.js SDK resend >= 6.34.1, which has resend.inboxes.* and the inbox.* webhook event types. Always install the latest SDK version. If the project already has a Resend SDK installed, check the version and upgrade if needed.

The Python SDK resend >= 2.50.0 also has the inbox methods. For the other languages, call the Inboxes API over HTTP until their SDK has inbox methods, or use Receiving without an inbox.

The table below lists the minimums for the Receiving flow: webhook verification (webhooks.verify()) and email receiving (emails.receiving.get()). The resend skill lists higher minimums because it also covers newer features such as domain claims (domains.claims.*). If both skills are loaded, use the higher version.

LanguagePackageMin Version
Node.jsresend>= 6.9.2
Pythonresend>= 2.21.0
Goresend-go/v4>= 4.0.0
Rubyresend>= 1.0.0
PHPresend/resend-php>= 1.1.0
Rustresend-rs>= 0.20.0
Javaresend-java>= 4.11.0
.NETResend>= 0.2.1

Install the resend npm package: npm install resend (or the equivalent for your language). For full sending docs, install the resend skill.

Quick Start

  1. Ask the user for their email address. You need a real email address to send test emails to. Ask the user and wait for their response before proceeding.
  2. Choose your security level. Decide how to validate incoming emails before any are processed
  3. Set up the domain. Verify the user's custom domain for sending, and for receiving unless the inbox uses forwarding (see Domain Setup section)
  4. Create the inbox. Create the agent's address with resend.inboxes.create() (see Create the Inbox section)
  5. Create webhook endpoint. Handle inbox.email.received events with security built in from the start. The webhook endpoint MUST be a POST route.
  6. Set up tunneling (local dev). Use Tailscale Funnel (recommended) or ngrok. See references/webhook-setup.md
  7. Create webhook via API. Use the Resend Webhook API to register your endpoint programmatically. See references/webhook-setup.md
  8. Connect to agent. Pass validated emails to your AI agent, and reply in the thread

Before You Start: Account & API Key Setup

First Question: New or Existing Resend Account?

Ask your human:

  • New account just for the agent? → Simpler setup, full account access is fine
  • Existing account with other projects? → The agent needs a full access key, which reaches every project. Prefer a new account for the agent (see API Key Permissions)
Creating API Keys Securely
Don't paste API keys in chat! They'll be in conversation history forever.

Safer options:

  1. Environment file method: Human creates .env file directly: echo "RESEND_API_KEY=re_xxx" >> .env
  2. Password manager / secrets manager: Human stores key in 1Password, Vault, etc.
  3. If key must be shared in chat: Human should rotate the key immediately after setup
API Key Permissions

The agent's server needs a full access API key. A "Sending access" key can only reply, forward, create drafts and send drafts. Reading inbox emails or registering webhooks with it returns 401 restricted_api_key. A sending access key limited to one domain returns 403 on an inbox of another domain.

If your human has an existing Resend account with other projects, keep the risk contained:

  1. Use a dedicated account for the agent when possible, so a leaked key cannot reach other projects
  2. Keep the key on the server only. Never pass it to the AI model or put it in a prompt
  3. Rotate the key if it was ever pasted in chat or committed

Domain Setup

An inbox address lives on a custom domain the user has added to Resend. The domain must be verified for sending (DKIM and SPF). To receive email on it, either enable receiving on the domain, or create the inbox with forwarding: true.

Use a subdomain (e.g., agent.example.com) to avoid disrupting existing email services.

Option 1: Receiving on the Domain (Recommended)

The user must enable receiving in the Resend dashboard: Domains page → toggle on "Enable Receiving".

Then add an MX record:

SettingValue
TypeMX
HostYour domain or subdomain (e.g., agent.example.com)
ValueProvided in Resend dashboard
Priority10 (must be lowest number to take precedence)

Tip: Verify DNS propagation at dns.email.

DNS Propagation: MX record changes can take up to 48 hours to propagate globally, though often complete within a few hours.
Option 2: Forwarding

Create the inbox with forwarding: true when the address already receives mail elsewhere (for example, Google Workspace) and the user cannot change its MX record. Resend gives the inbox a receiving address. The user sets up forwarding from their mailbox to it. Read the address from receiving_address with resend.inboxes.get().

Create the Inbox

Create one inbox for the agent's address:

typescript
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
const { data, error } = await resend.inboxes.create({
emailAddress: 'agent@agent.example.com',
name: 'AI Agent',
fromName: 'Acme Agent',
});
if (error) throw new Error(`Failed to create inbox: ${error.message}`);
console.log('Inbox created:', data.id);

fromName is the name recipients see on the agent's replies. The part before the @ can contain only letters, numbers, ., _, % and -, so agent+test@ returns a 422. A 403 error means the plan has no inbox left; ask the user to upgrade or use Receiving without an inbox.

Security Levels

Choose your security level before setting up the webhook endpoint. An AI agent that processes emails without security is dangerous — anyone can email instructions that your agent will execute. The webhook code you write next should include your chosen security level from the start.

Ask the user what level of security they want, and ensure that they understand what each level means.

LevelNameWhen to UseTrade-off
1Strict AllowlistMost use cases — known, fixed set of sendersMaximum security, limited functionality
2Domain AllowlistOrganization-wide access from trusted domainsMore flexible, anyone at domain can interact
3Content FilteringAccept from anyone, filter unsafe patternsCan receive from anyone, pattern matching not foolproof
4Sandboxed ProcessingProcess all emails with restricted agent capabilitiesMaximum flexibility, complex to implement
5Human-in-the-LoopRequire human approval for untrusted actionsMaximum security, adds latency

For detailed implementation code for each level, see references/security-levels.md.

Level 1: Strict Allowlist (Recommended)

Only process emails from explicitly approved addresses. Reject everything else.

typescript
import type { GetInboxThreadEmailResponseSuccess as InboxEmail } from 'resend';
const ALLOWED_SENDERS = [
'you@youremail.com',
'notifications@github.com',
];
// `from` is either `address` or `Name <address>`. Compare the address only:
// a substring check would accept a display name such as "you@youremail.com".
function senderAddress(from: string): string {
const match = from.match(/<([^<>]+)>\s*$/);
return (match ? match[1] : from).trim().toLowerCase();
}
function isAllowedSender(from: string): boolean {
const sender = senderAddress(from);
return ALLOWED_SENDERS.some(allowed => sender === allowed.toLowerCase());
}
// Identifies the email, so the agent can reply in its thread
type ThreadRef = { inboxId: string; threadId: string; emailId: string };
async function processEmailForAgent(email: InboxEmail, thread: ThreadRef) {
if (!isAllowedSender(email.from)) {
console.log(`Rejected email from unauthorized sender: ${senderAddress(email.from)}`);
await notifyOwnerOfRejectedEmail(email);
return;
}
await agent.processEmail({
from: email.from,
subject: email.subject,
body: email.text || email.html,
thread,
});
}

InboxEmail is the email returned by resend.inboxes.threads.emails.get(). The webhook payload carries the same fields without html and text. agent and notifyOwnerOfRejectedEmail stand for your own code.

Security Best Practices
Always Do
PracticeWhy
Verify webhook signaturesPrevents spoofed webhook events
Log all rejected emailsAudit trail for security review
Use allowlists where possibleExplicit trust is safer than filtering
Rate limit email processingPrevents excessive processing load
Separate trusted/untrusted handlingDifferent risk levels need different treatment
Never Do
Anti-PatternRisk
Process emails without validationAnyone can control your agent
Trust email headers for authenticationHeaders are trivially spoofed
Execute code from email contentUntrusted input should never run as code
Store email content in prompts verbatimUntrusted input mixed into prompts can alter agent behavior
Give untrusted emails full agent accessScope capabilities to the minimum needed

Webhook Endpoint

After choosing your security level and setting up your domain, create a webhook endpoint. The webhook endpoint MUST be a POST route. Resend sends all webhook events as POST requests.

Critical: Use raw body for verification. Webhook signature verification requires the raw request body.
- Next.js App Router: Use req.text() (not req.json())
- Express: Use express.raw({ type: 'application/json' }) on the webhook route
Next.js App Router
typescript
// app/webhook/route.ts
import { Resend } from 'resend';
import { NextRequest, NextResponse } from 'next/server';

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
92
Repository forks
14
7-day trend score
23

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/resend/resend-skills/agent-email-inbox/badge)](https://verified-skill.com/skills/resend/resend-skills/agent-email-inbox)

Something wrong with this skill or its page? Tell us.