π§© So, What Changed?
In the last post, I talked about this cool bot I found β a Telegram bot that handed out disposable emails and pinged you when you got mail. Super handy. But using that tool sparked something deeper:
"Why not build my own bot?"
Spoiler alert: I did.
βοΈ What I Wanted To Build
I wanted a bot that wasnβt just a gimmick β something that:
- π€ Responds to commands like
/start
,/help
, and/about
- π§ Remembers user sessions and states
- π¨ Lets users send a fake email from Telegram to an actual inbox
- π Maybe, just maybe, automate future workflows with buttons, menus, and replies
Basically, I wanted it to feel less like a bot and more like a cyber sidekick.
π§ Tools & Stack
- Language: Python 3
-
Bot Framework:
python-telegram-bot
- Hosting: Railway (yes, Iβm cheap and lazy)
- Email Relay: Integrated with SMTP for outbound fake emails
- Extras: Markdown formatting, async functions, and custom keyboards for replies
π οΈ The Build Process (With Dumb Mistakes I Made)
Step 1: Setting Up the Bot Token π
Grabbed the token from @botfather (yes, still feels like talking to mafia). Put it in a .env
file β lesson learned from hardcoding it once and almost pushing to GitHub. π
Step 2: Basic Command Handling π¦
Wired up /start
, /help
, and /reset
. Pretty straightforward.
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, "Hey, I'm your cyber mailman. Type /help to see what I do.")
Step 3: Sending Emails via Telegram π€
Hooked up the backend with SMTP. Had the user enter subject β recipient β body β in that order.
Also added some basic validation because people type like goblins.
Step 4: Buttons & Flow β¨
Instead of plain text, I used Telegram inline buttons. So now, itβs tap-and-go instead of sending a wall of text.
InlineKeyboardButton("Send New Email", callback_data='send_email')
π§ What I Learned
- How to use inline queries and callback handlers
- That bot UX is way harder than expected
- Sending emails from bots is easy, validating human input is not
- Hosting bots that don't go offline is a full-time job
π Future Plans
- Add a dashboard for viewing sent emails
- Schedule emails using cron
- Integrate with GPT for auto-generating email replies π€―
- Maybe⦠maybe even turn it into a public utility?
TL;DR
I used a Telegram bot.
I liked it.
I built my own bot.
It sends fake emails and talks like me.
Moral of the story? Curiosity + caffeine = shipping cool shit.
Built with π», β, and a hint of "I wonder if this breaks..."
Link?
Have it: https://t.me/mailer3000bot?start=_tgr_nrqbUw5iYWRl
Top comments (0)