TopGit
GitHub Repo Review

mail2telegram cloudflare email routing

tbxark/mail2telegram
MTopGit review image for tbxark/mail2telegram
Review by Topgit.dev for tbxark/mail2telegram, with GitHub repository stats and README context.
Quick verdict

mail2telegram does exactly one thing well: it converts incoming emails into Telegram notifications without you running a mail server. For developers already inside the Cloudflare ecosystem, the setup friction is low and the free tier covers most personal use cases. The catch is that it trades a traditional mail client for a Cloudflare dependency, and the no-attachments limitation means attachments still need a separate forwarding path.

Stars
โ˜… 835
Forks
โ‘‚ 124
Contributors
๐Ÿ‘ฅ 6
Language
TypeScript
License
MIT
Topic
โ€”
Updated
Aug 2026

What is mail2telegram

mail2telegram is a Cloudflare Worker that receives emails via Cloudflare Email Routing and pushes them as formatted messages to a Telegram bot. Each email becomes a Telegram message with inline buttons to preview text, view full content in a browser, or read an AI-generated summary. The worker stores inbox state and filter rules in a KV namespace you bind yourself.

Key features of mail2telegram

  • โœ“Email routing via Cloudflare Workers โ€” no dedicated server or mail software required
  • โœ“Inline Telegram buttons: Preview, Summary (AI), Text, and HTML view modes
  • โœ“Disposable inbox creation with any recipient prefix, managed through the bot
  • โœ“Sender whitelist/blacklist managed via a built-in Telegram mini-app
  • โœ“AI email summarization using Workers AI or a custom OpenAI API key
  • โœ“KV-backed storage for inbox state, filter rules, and email cache with configurable TTL
  • โœ“Guardian Mode to suppress duplicate notifications from Worker retries
  • โœ“Optional email backup forwarding to a personal address via FORWARD_LIST
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Practical use cases for mail2telegram

  • โ€ขMonitoring transactional emails โ€” order confirmations, shipping updates, password resets โ€” without a full mail client open
  • โ€ขCreating throwaway inbox addresses on the fly for services you don't fully trust, read directly from Telegram
  • โ€ขLightweight email automation: filter by sender regex and receive only the notifications you care about, discarding the rest silently
  • โ€ขSpam triage at the gateway level โ€” use whitelist rules to auto-forward only known senders and block the rest server-side before they hit your device

Deploying mail2telegram to Cloudflare Workers

Deploying requires a Cloudflare account with Email Routing enabled, a Telegram bot token from @BotFather, and a KV namespace to bind. Clone the repo, copy `wrangler.example.jsonc` to `wrangler.jsonc` with your credentials, then run `yarn pub`. After deployment, call your worker URL at `/init` to bind the Telegram webhook. Cloudflare's free Workers tier handles moderate personal use without billing. Both CLI deployment and a copy-paste path for precompiled code are documented.

Using the bot after deployment

After binding Cloudflare Email Routing to forward all emails to your worker, incoming mail triggers a Telegram message with subject, sender, recipient, and four action buttons. The Preview button shows plain text up to 4096 characters directly in chat. Summary generates a short AI digest using Workers AI or your OpenAI key. Text opens a web page for longer emails, and HTML renders rich-text emails with a warning about tracking scripts. The Telegram mini-app manages whitelist and blacklist rules without touching environment variables. Emails expire from the cache after MAIL_TTL seconds for security.

Strengths

  • โœ“Runs on Cloudflare Workers โ€” zero infrastructure to maintain, free tier is generous for personal use
  • โœ“TypeScript codebase is readable and deploys in minutes via wrangler
  • โœ“Built-in mini-app handles sender filtering without editing environment variables
  • โœ“Multi-ID support: one worker can notify multiple Telegram accounts, useful for shared inboxes
  • โœ“Configurable max email size and truncation policy to prevent worker timeouts on large messages
  • โœ“AI summarization without mandatory API key if you bind Cloudflare Workers AI

Known limitations of mail2telegram

  • โ–ณNo attachment support โ€” the README explicitly acknowledges this and points to a separate project (testmail-viewer) for attachment forwarding
  • โ–ณThe entire workflow depends on Cloudflare Email Routing and Workers reliability, so an outage on either service breaks message delivery.
  • โ–ณGuardian Mode (duplicate suppression) consumes extra KV writes, which has both cost and rate-limit implications at scale
  • โ–ณUsing the Telegram mini-app requires setting a public privacy policy via @BotFather, which may not suit enterprise environments
  • โ–ณNo native reply-to-email functionality without binding Resend and providing an API key

Alternatives to mail2telegram

testmail-viewer โ€” the author's own project for forwarding emails with attachments to a test inbox, works alongside mail2telegram via FORWARD_LISTForwardEmail.net โ€” a managed email forwarding service with custom domains, no Cloudflare dependency but lacks Telegram integrationMailgun Routes โ€” traditional email routing with webhook delivery to any endpoint, more flexible but requires more setup than this focused bot

Frequently asked questions

Is mail2telegram free to use?

mail2telegram itself is MIT-licensed and costs nothing. You only pay for Cloudflare Workers usage, which fits within the free tier for typical personal inboxes.

Does mail2telegram support email attachments?

No. The README acknowledges this explicitly. Attachments must be forwarded to a separate service like the author's testmail-viewer using the FORWARD_LIST environment variable.

How do I initialize the mail2telegram bot after deployment?

Visit your worker URL at the /init endpoint once โ€” for example, https://project_name.user_name.workers.dev/init. The response confirms whether the Telegram webhook bound successfully.

What is Guardian Mode in mail2telegram?

Guardian Mode tracks the state of each email notification in KV storage to detect and suppress retries. It reduces duplicate messages caused by Cloudflare Worker timeouts, but it increases KV write usage.

Can I use my own OpenAI API key with mail2telegram for summaries?

Yes. Set the OPENAI_API_KEY environment variable and the bot will generate AI summaries without requiring Cloudflare Workers AI.

How does mail2telegram handle duplicate email notifications?

Cloudflare Workers may retry timed-out emails, sending duplicate notifications. mail2telegram offers two defenses: a backup email in FORWARD_LIST preserves messages server-side, and optional Guardian Mode tracks state in KV to suppress retries locally.

The problem it solves

Getting email notifications on the go usually means running a full mail client, configuring IMAP/SMTP, or paying for a forwarding service. Temporary or disposable email workflows are even messier, often requiring third-party services with rate limits or accounts to manage.

Who should try it โ€” and who should skip

Developers already using Cloudflare Pages or Workers who want email-to-Telegram notifications without running a mail server will find the setup worthwhile. It is particularly useful for monitoring transactional emails and creating disposable addresses on the fly. If you need attachment support, strict data-residency controls, or want to avoid Cloudflare vendor lock-in entirely, look elsewhere โ€” or at least budget time to route attachments separately.

Related repositories

Source & attribution

Repository: https://github.com/tbxark/mail2telegram

GitHub data ยท last synced Aug 17, 2026Reviewed by Henry
โ† Back to TopGit

Want a second opinion on mail2telegram?

Ask an AI that can read this page โ€” one click and you get its take on mail2telegram.

GitHub