A disposable email Telegram bot powered by Cloudflare Workers and Cloudflare Email Routing. Get instant temporary email addresses and receive real-time notifications with automatic OTP detection 🔐
🤖 Try it: @FlatMailBot
Note: This repository only contains the core email receiving feature. Additional features (send email, premium plans, payment system, multi-slot, etc.) are not included in this public release.
- 📬 Instant disposable email generation
- 🔑 Automatic OTP & verification code detection
- 📩 Real-time email notifications via Telegram
- ⏱️ Auto-expiring emails with expiry warnings
- 🗑️ Manual email deletion
- 🌐 Powered entirely by Cloudflare free tier
- ⚡ Lightning-fast processing with Cloudflare Workers
Email sent to your@xxxx
↓
Cloudflare Email Routing
↓
Cloudflare Worker (this code)
↓
Parse email → detect OTP
↓
Telegram notification with Copy Code button
- Cloudflare account (free)
- Domain connected to Cloudflare
- Telegram bot token from @BotFather
- Wrangler CLI
git clone https://github.com/andiasriefail2004/FlatMail.git
cd FlatMailnpm installname = "flatmail-bot"
main = "src/index.js"
compatibility_date = "2024-01-01"
[[kv_namespaces]]
binding = "FLATMAIL"
id = "YOUR_KV_NAMESPACE_ID"
[triggers]
crons = ["* * * * *"]wrangler secret put TELEGRAM_BOT_TOKEN
wrangler secret put TELEGRAM_CHAT_IDTELEGRAM_CHAT_ID is your personal Telegram ID (owner). Get it from @userinfobot.
In your Cloudflare dashboard:
- Go to your domain → Email Routing
- Enable Email Routing
- Add a Catch-all rule → action: Send to Worker → select your deployed worker
https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=https://YOUR_WORKER_URL
wrangler deploy| Command | Description |
|---|---|
/start |
Generate a new temporary email |
/next |
Replace current email with a new one |
Edit constants at the top of src/index.js to customize behavior:
| Constant | Default | Description |
|---|---|---|
DOMAIN |
flatmail.xxx.xx |
Your email domain |
FREE_TTL |
600 |
Email lifetime in seconds (10 min) |
FREE_DAILY_LIMIT |
3 |
Max emails per day for free users |
| Key | Description |
|---|---|
email:{address} |
Email record (chatId, expiry, etc.) |
expiry:{address} |
Expiry tracking for cron job |
user:{chatId} |
User data |
daily:{chatId}:{date} |
Daily usage counter |
MIT