/marketing-cli:agent-email-inboxfrom marketing-cli
Configures a secure email inbox for AI agents using Resend, webhooks, and tunneling. Implements security measures to prevent prompt injection attacks via email.
Ships in marketing-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Set up a secure email inbox that lets an AI agent receive and respond to emails, with protection against prompt injection and email-based attacks.
Core principle: An AI agent's inbox is a potential attack vector. Malicious actors can email instructions that the agent might blindly follow. Security configuration is not optional — it's the first thing you implement, not the last.
This skill is context-independent — it does not use brand/ files and works identically in any project.
Output: A configured webhook handler file, environment variable checklist, and security configuration.
Sender → Email → Resend (MX) → Webhook → Your Server → AI Agent
↓
Security Validation
↓
Process or Reject
Ask the user:
Don't paste API keys in chat! They'll persist in conversation history. Have the user write directly to
.envor use a secrets manager.
Use your auto-generated address: <anything>@<your-id>.resend.app. No DNS configuration needed.
The user enables receiving in the Resend dashboard, then adds an MX record:
| Setting | Value |
|---|---|
| Type | MX |
| Host | Your domain or subdomain (e.g., agent.yourdomain.com) |
| Value | Provided in Resend dashboard |
| Priority | 10 (lowest number takes precedence) |
Use a subdomain (e.g., agent.yourdomain.com) to avoid disrupting existing email services on your root domain — otherwise all email routes to Resend.
The user registers a webhook in Resend dashboard (Webhooks → Add Webhook → select email.received). They need the endpoint URL you'll create and the signing secret for verification.
// app/api/webhooks/email/route.ts (Next.js App Router)
import { Resend } from 'resend';
import { NextRequest, NextResponse } from 'next/server';
const resend = new Resend(process.env.RESEND_API_KEY);
export async function POST(req: NextRequest) {
try {
const payload = await req.text();
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') {
const { data: email } = await resend.emails.receiving.get(
event.data.email_id
);
// Security validation happens here (see Security Levels)
await processEmailForAgent(event.data, email);
}
return new NextResponse('OK', { status: 200 });
} catch (error) {
console.error('Webhook error:', error);
return new NextResponse('Error', { status: 400 });
}
}
Resend retries failed deliveries with exponential backoff over ~6 hours. Emails are stored even if webhooks fail.
Your local server isn't accessible from the internet. Use tunneling to expose it:
| Option | Persistent URL? | Cost |
|---|---|---|
| ngrok (paid) | Yes (static subdomain) | $8/mo |
| Cloudflare named tunnel | Yes (your own domain) | Free |
| ngrok (free) | No (changes on restart) | Free |
| VS Code Port Forwarding | No (changes per session) | Free |
For webhooks, persistent URLs matter — otherwise you re-register the URL every time the tunnel restarts. See the tunneling docs for each tool for setup instructions.
# ngrok (paid - recommended for persistent dev)
ngrok http --domain=myagent.ngrok.io 3000
# Cloudflare named tunnel (free but more setup)
cloudflared tunnel run my-agent-webhook
For a reliable agent inbox, deploy to production rather than relying on tunnels:
This is the most critical part of the setup. An AI agent that processes emails without security is dangerous.
There are 5 graduated security levels. Read references/security-levels.md for complete code examples and implementation details. Present the options to the user and help them choose:
| Level | Approach | Best For |
|---|---|---|
| 1. Strict Allowlist | Only process emails from approved addresses | Personal assistant agents |
| 2. Domain Allowlist | Allow any address at approved domains | Team/org internal agents |
| 3. Content Filtering | Accept from anyone, filter injection patterns | Customer support agents |
| 4. Sandboxed Processing | Accept all, restrict agent capabilities | Public-facing agents |
| 5. Human-in-the-Loop | Require human approval for untrusted senders | High-stakes agents |
Levels can be combined (e.g., Domain Allowlist + Content Filtering).
| Practice | Why |
|---|---|
| Verify webhook signatures | Spoofed events let attackers control your agent |
| Log all rejected emails | Audit trail reveals attack patterns |
| Use allowlists where possible | Explicit trust is safer than trying to filter bad input |
| Rate limit email processing | A flood of emails can overwhelm your agent or exhaust API quotas |
| Separate trusted/untrusted handling | Different risk levels need different agent capabilities |
| Anti-Pattern | Risk |
|---|---|
| Processing emails without validation | Anyone can control your agent by sending an email |
| Trusting email headers for authentication | "From:" headers are trivially spoofed — use webhook verification instead |
| Executing code from email content | Remote code execution — the most dangerous vulnerability |
| Storing email content in prompts verbatim | Prompt injection attacks bypass your security layer entirely |
| Giving untrusted emails full agent access | One malicious email could compromise your entire system |
Connect your webhook to your AI agent:
async function processWithAgent(email: ProcessedEmail) {
const message = `New Email\nFrom: ${email.from}\nSubject: ${email.subject}\n\n${email.body}`.trim();
await sendToAgent(message);
}
Alternatively, the agent can poll the Resend API during heartbeats instead of using webhooks — simpler architecture but less immediate.
See references/security-levels.md for the complete secure agent inbox implementation with configurable security levels, rate limiting, content truncation, and rejection logging.
RESEND_API_KEY=re_xxxxxxxxx
RESEND_WEBHOOK_SECRET=whsec_xxxxxxxxx
SECURITY_LEVEL=strict # strict | domain | filtered | sandboxed
[email protected],[email protected]
ALLOWED_DOMAINS=yourcompany.com
[email protected] # For security notifications
| Mistake | Why It's a Problem | Fix |
|---|---|---|
| No sender verification | Anyone can control your agent | Implement a security level (start with Level 1) |
| Trusting email headers | Headers are trivially spoofed | Rely on webhook signature verification only |
| Same treatment for all emails | Trusted and untrusted senders have different risk profiles | Use capability-based access control |
| Using ephemeral tunnel URLs | URL changes on restart, breaking webhook delivery | Use paid ngrok or Cloudflare named tunnels |
| No rate limiting | Flooding attacks can overwhelm the agent | Implement per-sender rate limits |
| Processing HTML directly | HTML can contain hidden injection content | Strip to plain text before processing |
[email protected] — simulates successful delivery[email protected] — simulates hard bouncesend-email — sending emails from your agentresend-inbound — detailed inbound email processing (domain setup, content retrieval, attachments)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
agent-email, email-inbox, resend, webhook, prompt-injection, email-security
npx claudepluginhub moizibnyousaf/marketing-cli --plugin marketing-cli76 skills in this plugin
/ai-seoBuilds, measures, and improves an Answer Engine Optimization program across ChatGPT, Perplexity, Claude, Gemini, Google AI Overviews, and Copilot. Use for AEO, GEO, LLMO, AI search visibility, AI citations, brand mentions, answer-engine monitoring, llms.txt, AI crawler audits, or questions like 'what does AI say about us?' and 'why are competitors cited instead of us?'. Produces a durable evidence report and prioritized gameplan, not a one-shot content checklist./app-store-screenshotsGenerate Apple App Store screenshot pages as a Next.js app with html-to-image export at required resolutions. Screenshots are advertisements, not documentation — every screenshot sells one idea. Use when building App Store screenshots, generating exportable marketing screenshots for iOS apps, or creating programmatic screenshot generators. Triggers on 'app store screenshots', 'App Store', 'screenshot generator', 'iOS screenshots', 'marketing screenshots', 'phone mockup', 'ASO screenshots', 'app store assets', 'app listing', 'app store page', or 'app preview images'. Also use when someone is about to submit an app and needs store assets, or when they say 'make my app store page look good'. Includes iPhone and iPad mockup components with pre-measured dimensions./audience-researchBuild detailed buyer personas and audience profiles from research. Use this skill whenever the user mentions audience, buyer persona, ideal customer, target market, ICP, watering holes, 'who am I selling to', customer research, or audience profile. Also use when content feels unfocused or generic (that's an audience problem), when conversion is low because messaging doesn't resonate, when starting any new project (audience should be first), or when any downstream skill needs audience.md but it doesn't exist yet. Even if the user doesn't explicitly ask for audience research, trigger this if they're writing copy or building a landing page without a clear audience defined. Three approaches: Quick Profile, Persona Build, Community Mining.
/axiAgent eXperience Interface (AXI) router — the main entry point for agent-ergonomic CLIs. Use whenever the agent needs GitHub, browser automation, human review, quota routing, Slack, Notion, AWS/Docker/K8s, databases, GitLab (glab-axi), Oracle DB (oracle-axi), tmux/herdr/WezTerm sessions (cyber-mux), or any AXI-catalog tool; when choosing AXI vs MCP vs raw CLI; when building or reviewing an agent-facing CLI; or when the user says axi, gh-axi, chrome-devtools-axi, TOON output, agent ergonomics, or "prefer AXI". When in doubt about which external tool interface to use, start here.
/brainstormStructured marketing brainstorming when direction is unclear. Use when the agent doesn't know which skill to run, the user is vague about what they need, there are multiple valid marketing paths, or someone says 'I don't know where to start', 'what should we market', 'explore approaches', 'help me think through this', 'marketing ideas', 'what campaign should I run', 'where do I start with marketing', 'what's our marketing plan', or 'I have no idea how to promote this'. Explores 2-3 approaches and recommends the best path forward with a specific next-skill handoff. Even vague frustration like 'nobody knows about my product' or 'how do I get users' should trigger this when no specific channel or tactic is mentioned.
/brand-kit-playgroundGenerate an interactive HTML brand playground that shows your brand rendered live — palette, typography, logo, voice — with a social card and OG image preview that updates as you tweak tokens. Opens in browser. The visual approval step for the /cmo flow: /visual-style writes the brand, this skill shows it. Use when the user says "show me my brand", "brand playground", "preview my brand", "what does our brand look like", "visual preview", "brand kit", "see my colors", "how does my brand look", or after /visual-style completes and the user needs to approve the visual identity before moving to content generation. Also use when someone says "I want to see it" during any brand-building conversation.
Other plugins' skills for the same job