Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

FlatMail 📬

License: MIT Node.js Cloudflare Workers Telegram Bot API GitHub

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.


✨ Features

  • 📬 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

🔄 How It Works

Email sent to your@xxxx
        ↓
Cloudflare Email Routing
        ↓
Cloudflare Worker (this code)
        ↓
Parse email → detect OTP
        ↓
Telegram notification with Copy Code button

🛠️ Stack


📋 Requirements


🚀 Setup

1. Clone the repository

git clone https://github.com/andiasriefail2004/FlatMail.git
cd FlatMail

2. Install dependencies

npm install

3. Configure wrangler.toml

name = "flatmail-bot"
main = "src/index.js"
compatibility_date = "2024-01-01"

[[kv_namespaces]]
binding = "FLATMAIL"
id = "YOUR_KV_NAMESPACE_ID"

[triggers]
crons = ["* * * * *"]

4. Add secrets

wrangler secret put TELEGRAM_BOT_TOKEN
wrangler secret put TELEGRAM_CHAT_ID

TELEGRAM_CHAT_ID is your personal Telegram ID (owner). Get it from @userinfobot.

5. Set up Cloudflare Email Routing

In your Cloudflare dashboard:

  1. Go to your domain → Email Routing
  2. Enable Email Routing
  3. Add a Catch-all rule → action: Send to Worker → select your deployed worker

6. Set Telegram webhook

https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=https://YOUR_WORKER_URL

7. Deploy

wrangler deploy

💬 Commands

Command Description
/start Generate a new temporary email
/next Replace current email with a new one

⚙️ Configuration

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

📦 KV Structure

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

📄 License

MIT


👤 Author

@andiasriefail

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages