Skip to content

ozeg8/mail-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python OpenAI Telegram Gmail

📬 Mail Tracker — AI-Powered Email Intelligence Agent

An intelligent email monitoring agent that reads your Gmail in real time, analyzes every incoming message using AI, and instantly delivers categorized, actionable summaries to your Telegram — so you never miss what matters.


✨ Features

  • Real-time Gmail Monitoring — Checks for new emails every 60 seconds, automatically skipping existing ones on startup.
  • AI-Powered Analysis — Every email is analyzed by GPT-4o-mini: category, importance score, summary, and action required.
  • Smart Filtering — Ads, newsletters, and promotional emails are silently ignored. Only what matters reaches you.
  • Instant Telegram Notifications — Get structured, readable summaries delivered directly to your Telegram bot.
  • 7 Smart Categories — Job applications, personal messages, invoices, meeting invites, important alerts, and more.
  • Zero Noise — Importance scoring (1–10) ensures low-value emails never interrupt you.

📸 Preview

Telegram Notification Preview


🛠️ Tech Stack

Tool Purpose
Python Core programming language
Gmail API Email access via OAuth 2.0
OpenAI GPT-4o-mini Email analysis & categorization
Telegram Bot API Real-time push notifications
python-dotenv Secure environment variable management

📂 Project Structure

mail-tracker/
├── main.py              # Entry point — monitoring loop
├── gmail_client.py      # Gmail OAuth connection & email fetching
├── ai_analyzer.py       # OpenAI-powered email analysis
├── telegram_client.py   # Telegram notification delivery
├── requirements.txt     # Python dependencies
├── .env.example         # Environment variable template
└── credentials.json     # Gmail OAuth credentials (not committed)

⚙️ Installation

1. Clone the repository

git clone https://github.com/ozeg8/mail-tracker.git
cd mail-tracker

2. Install dependencies

pip install -r requirements.txt

3. Set up Gmail API

  • Go to Google Cloud Console
  • Create a project and enable the Gmail API
  • Create OAuth 2.0 credentials (Desktop App)
  • Download credentials.json and place it in the project root

4. Create a Telegram Bot

  • Message @BotFather on Telegram
  • Create a new bot and copy the token
  • Get your chat ID via https://api.telegram.org/bot<TOKEN>/getUpdates

5. Configure environment variables

Create a .env file in the project root:

OPENAI_API_KEY=your_openai_api_key
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id

6. Run

python main.py

On first run, a browser window will open for Gmail authorization. After that, token.json is created and authorization is automatic.


📩 Notification Format

💰 Fatura/Ödeme
👤 Gönderen: John Doe <john@example.com>
📋 Konu: Invoice #1042
📝 Özet: Monthly subscription invoice for April 2026.
⚡ Aksiyon: Evet
🕐 Sat, 11 Apr 2026 12:05:59 +0300

📫 Contact

Built by Ozer Emir Gurtekin
GitHub · LinkedIn

About

AI-powered email monitoring agent — Gmail + OpenAI + Telegram

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages