secondsky/claude-skills / plugins/cloudflare-email-routing/skills/cloudflare-email-routing
cloudflare-email-routing
UnverifiedCloudflare Email Routing for receiving/sending emails via Workers. Use for email workers, forwarding, allowlists, or encountering Email Trigger errors, worker call failures, SPF issues.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.0 KB |
| references/common-errors.md | markdown | 16.1 KB |
| references/dns-setup.md | markdown | 11.9 KB |
| references/local-development.md | markdown | 14.7 KB |
| references/setup-guide.md | markdown | 4.2 KB |
| templates/receive-allowlist.ts | script | 1.8 KB |
| templates/receive-basic.ts | script | 1.6 KB |
| templates/receive-blocklist.ts | script | 1.8 KB |
| templates/receive-reply.ts | script | 2.7 KB |
| templates/send-basic.ts | script | 2.1 KB |
| templates/send-notification.ts | script | 4.5 KB |
| templates/wrangler-email.jsonc | other | 1.8 KB |
templates/receive-reply.ts
View on GitHub/**
* Auto-Reply Email Worker
*
* Automatically reply to incoming emails with a custom message.
* Useful for out-of-office replies, support acknowledgments, etc.
*
* Features:
* - Parse incoming email subject and body
* - Send automatic reply with custom message
* - Forward original email to team inbox
* - Preserve email threading with In-Reply-To header
*
* To use:
* 1. Install dependencies: npm install postal-mime mimetext
* 2. Update REPLY_CONFIG with your settings
* 3. Deploy: npx wrangler deploy
* 4. Bind to email route in dashboard
*/
import PostalMime from 'postal-mime';
import { createMimeMessage } from 'mimetext';
import { EmailMessage } from 'cloudflare:email';
interface Env {
// Add environment bindings here if needed
// DB?: D1Database;
}
// Configuration
const REPLY_CONFIG = {
senderName: 'Support Team',
senderEmail: 'support@yourdomain.com',
forwardTo: 'team@yourdomain.com', // Where to forward original email
replyTemplate: (subject: string, fromEmail: string) => `
Thank you for your email regarding "${subject}".
We have received your message and will respond within 24 hours.
Your message has been logged with our support team.
Best regards,
Support Team
`.trim(),
};
export default {
async email(message, env: Env, ctx) {
try {
console.log('Processing email from:', message.from);
// Parse incoming email
const parser = new PostalMime.default();
const email = await parser.parse(
await new Response(message.raw).arrayBuffer()
);
console.log('Subject:', email.subject);
// Create auto-reply message
const msg = createMimeMessage();
msg.setSender({
name: REPLY_CONFIG.senderName,
addr: REPLY_CONFIG.senderEmail,
});
msg.setRecipient(message.from);
// Preserve email thread with In-Reply-To header
const messageId = message.headers.get('Message-ID');
if (messageId) {
msg.setHeader('In-Reply-To', messageId);
}
msg.setSubject(`Re: ${email.subject}`);
msg.addMessage({
contentType: 'text/plain',
data: REPLY_CONFIG.replyTemplate(email.subject, message.from),
});
// Send reply
const replyMessage = new EmailMessage(
REPLY_CONFIG.senderEmail,
message.from,
msg.asRaw()
);
await message.reply(replyMessage);
console.log('Auto-reply sent to:', message.from);
// Forward original email to team
await message.forward(REPLY_CONFIG.forwardTo);
console.log('Original email forwarded to team');
} catch (error) {
console.error('Error processing email:', error);
message.setReject('Unable to process email');
}
},
};
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |