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/send-basic.ts
View on GitHub/**
* Send Email - Basic Example
*
* This Worker demonstrates sending emails using the send_email binding.
*
* Prerequisites:
* 1. Email Routing enabled on your domain
* 2. Destination address verified in Email Routing settings
* 3. send_email binding configured in wrangler.jsonc:
*
* "send_email": [
* {
* "name": "EMAIL",
* "destination_address": "notifications@yourdomain.com"
* }
* ]
*
* To use:
* 1. Install dependencies: npm install mimetext
* 2. Configure wrangler.jsonc with send_email binding
* 3. Deploy: npx wrangler deploy
* 4. Visit worker URL or trigger via fetch()
*/
import { EmailMessage } from 'cloudflare:email';
import { createMimeMessage } from 'mimetext';
interface Env {
// Send email binding (configured in wrangler.jsonc)
EMAIL: {
send(message: EmailMessage): Promise<void>;
};
}
export default {
async fetch(request: Request, env: Env, ctx): Promise<Response> {
try {
// Create email message
const msg = createMimeMessage();
// Set sender (must be from your domain with Email Routing enabled)
msg.setSender({
name: 'My Application',
addr: 'noreply@yourdomain.com',
});
// Set recipient
msg.setRecipient('user@example.com');
// Set subject
msg.setSubject('Welcome to My Application');
// Add plain text message
msg.addMessage({
contentType: 'text/plain',
data: 'Thank you for signing up! We are excited to have you on board.',
});
// Optional: Add HTML version
msg.addMessage({
contentType: 'text/html',
data: '<h1>Welcome!</h1><p>Thank you for signing up!</p>',
});
// Create EmailMessage and send
const emailMessage = new EmailMessage(
'noreply@yourdomain.com',
'user@example.com',
msg.asRaw()
);
await env.EMAIL.send(emailMessage);
return new Response('Email sent successfully!', { status: 200 });
} catch (error) {
console.error('Error sending email:', error);
return new Response('Failed to send email', { status: 500 });
}
},
};
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 |