Rule
0 installs · 0 said it worked
Set up email-to-Telegram forwarding via Cloudflare Email Routing
Cursor rule that guides the assistant through deploying a Cloudflare Worker and Email Routing with the mail2tg CLI so a domain's email is forwarded to a Telegram chat, including prerequisites, a plan-first approval step, and common errors.
People use this for
- email to telegram forwarding
- cloudflare email routing telegram
- forward domain email to telegram chat
- set up cloudflare worker email forwarding
- Name
set-up-email-to-telegram-forwarding-via-cloudflare-email-routing- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/set-up-email-to-telegram-forwarding-via-cloudflare-email-routing-3d35/export/mdc" -o .cursor/rules/set-up-email-to-telegram-forwarding-via-cloudflare-email-routing.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save set-up-email-to-telegram-forwarding-via-cloudflare-email-routing.mdc as .cursor/rules/set-up-email-to-telegram-forwarding-via-cloudflare-email-routing.mdc for this project or ~/.cursor/rules/set-up-email-to-telegram-forwarding-via-cloudflare-email-routing.mdc for every project, then start a new session.
Rule
description: "Cursor rules for setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI." globs: */ alwaysApply: false
You are an expert at setting up email-to-Telegram forwarding using Cloudflare Email Routing and Workers.
When the user asks to set up email forwarding to Telegram, route domain email to Telegram, or mentions "mail2tg", "email to telegram", follow this workflow.
Tool
Use the mail2tg CLI published on npm: https://www.npmjs.com/package/mail2tg
Source: https://github.com/shatzibitten/mail2tg
Prerequisites
- Domain DNS managed by Cloudflare (nameservers pointing to Cloudflare, status "Active").
- Cloudflare API token with scopes: Zone Read, DNS Edit, Worker Scripts Edit, Email Routing Rules Edit. Create at dash.cloudflare.com/profile/api-tokens → "Create Custom Token".
- Telegram bot created via @BotFather, token copied. User has sent /start to the bot.
- Node.js >= 20.
Plan-first workflow
export CLOUDFLARE_API_TOKEN="<token>"
export TELEGRAM_BOT_TOKEN="<bot-token>"
# Replace <reviewed-version> only after reviewing the npm package and source.
MAIL2TG_DOMAIN=example.com \
MAIL2TG_MAILBOX=info@example.com \
npx -y mail2tg@<reviewed-version> init --json
npx -y mail2tg@<reviewed-version> plan --json
# Stop here, show the plan to the user, and wait for explicit approval.
npx -y mail2tg@<reviewed-version> apply --json
npx -y mail2tg@<reviewed-version> doctor --json
Interactive workflow
npx -y mail2tg@<reviewed-version> init
export CLOUDFLARE_API_TOKEN="<token>"
export TELEGRAM_BOT_TOKEN="<bot-token>"
npx -y mail2tg@<reviewed-version> plan
# Stop here, show the plan to the user, and wait for explicit approval.
npx -y mail2tg@<reviewed-version> apply
npx -y mail2tg@<reviewed-version> doctor
What it does
- Deploys a Cloudflare Worker that parses incoming emails (MIME) and forwards headers, body, and attachments (up to 50 MB) to a Telegram chat via Bot API.
- Creates MX and SPF DNS records so Cloudflare receives mail for the domain.
- Creates an Email Routing rule directing the configured address to the Worker.
- Sets Worker secrets (TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID).
After apply, nothing runs locally. Everything is serverless on Cloudflare's edge. Free tier covers 100K emails/day.
Exit codes
- 0: success
- 2: missing config or env vars
- 3: Cloudflare/Telegram API error
- 4: doctor checks failed
- 5: worker deployment failed
Common issues
- "Telegram chat_id not found" → user must send /start to the bot, then re-run.
- "Cloudflare zone not found" → domain not on Cloudflare or token lacks Zone Read scope.
- "Worker deployment failed" → check internet; run
npx wrangler whoamito debug.
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Security guardrails that keep an AI email assistant from being hijacked by malicious messages
A full system prompt giving an AI assistant that reads or manages email a security mindset: treat email as untrusted data, require approval for outward actions, avoid leaking private data, and report phishing and injection attempts calmly.
Productivity · @thanos0000
- Go backend coding spec for vertical domain modules using shanjunmei/dig
A system-prompt skill that makes the model act as a Go architect and generate or repair code with vertical domain modules, viper config loading, minimal naming, and a unified RegisterRoute handler method for shanjunmei/dig compile-time DI.
Coding · @shanjunmei
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
- Nginx config security review with fixes and checker script
Agent skill that reviews nginx configs for TLS, header, alias traversal, admin exposure and rate-limit problems, runs a stdlib checker, and returns a minimal route-preserving fixed config with reload and curl test steps.
Coding · @f
- Context7 agent that answers library questions from up-to-date docs
Agent instructions that force lookup of current library documentation via Context7 before answering framework or package questions, and check workspace versions for upgrades.
Coding · @joembolinas
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.