Email Worker that sends you notifications on Telegram once emails are received.
- Fork the repository
- Set up the necessary environment variables in
wrangler.toml
:TOKEN
: Telegram bot token (get it from BotFather)database_id
: create D1 databaseemaildb
& get it's id hereCFURL
:https://example.example.workers.dev/
your cf worker url with / trailing
- Edit
src/index.js
email addresses to their corresponding chatIds and forward email ids, and toForward status
const emailList = [
{ to: "[email protected]", chatId: 5071059420, fMailid: "[email protected]", toForward: false }, //only sends notification as its false
{ to: "[email protected]", chatId: 5071059420, fMailid: "[email protected]", toForward: true }, //sends & forward
{ to: "[email protected]", chatId: 5071059420, fMailid: "[email protected]", toForward: false },
];
- Set up the necessary environment variables secrets in
Settings
:CLOUDFLARE_TOKEN
: Generate from cloudflare account
- Go to D1
emaildb
database console & execute
CREATE TABLE CFWTGW (
id INT PRIMARY KEY,
html TEXT
);
- Run
Deploy to Cloudflare Workers
action
Once the app is running, it will listen for incoming messages on Telegram and automatically forward any received emails to the specified email address. Additionally, it will send a notification message to the specified Telegram chat with a link to the email content on Spacebin.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.