Skip to content

πŸ€– MailBot | A low-cost and lightweight mail agent.

License

Notifications You must be signed in to change notification settings

LanternCX/MailBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– MailBot

Python License

δΈ­ζ–‡ | English

Your AI Mail Management Agent

An intelligent assistant that understands, summarizes, and processes your emails according to your rules.


🎬 Preview

Preview

✨ Features

  • AI Agent: LLM-based email content understanding, importance detection, and summarization.
  • Ultra-low Cost: Minimal prompt usage ensures extremely low token costs.
  • Multi-Provider: Seamless integration with OpenAI, Claude, Gemini, DeepSeek, Ollama, etc.
  • Rule Engine: Define your email processing preferences via Telegram using natural language.
  • Multi-Language Support: Automatic language detection and translation to break reading barriers.
  • Interactive Setup: CLI wizard for easy account and AI configuration management.
  • Privacy First: Supports local models (Ollama) and self-hosted APIs for complete data control.

🧠 Supported Models

MailBot supports a wide range of LLM providers via LiteLLM:

Provider Group Supported Providers
OpenAI & Compatible OpenAI, OpenRouter, Together AI, Fireworks AI
Frontier Models Anthropic (Claude), Google Gemini, Mistral, Groq
China-Friendly DeepSeek, Qwen, Moonshot, MiniMax
Research / Web Perplexity, Cohere
Local & Custom Ollama, Custom OpenAI-Compatible

For a full list of models supported by LiteLLM, please refer to the LiteLLM Providers Documentation.

πŸš€ Quick Start

Method 1: Executable (Recommended)

  1. Download & Unzip
    Get the release package from Releases and extract it.

    # Example: Unzip the downloaded file
    unzip mailbot-v1.0.0-macos-arm64.zip -d mailbot
    cd mailbot
  2. Run Application
    Execute the binary. The config.json will be created automatically if missing.

    Linux / Windows (PowerShell):

    # Linux
    chmod +x mailbot-linux-x64
    ./mailbot-linux-x64
    
    # Windows
    .\mailbot-windows-x64.exe

    macOS (Requires Gatekeeper clearance):

    # Remove quarantine attribute
    xattr -d com.apple.quarantine mailbot-macos-arm64
    
    # Run
    ./mailbot-macos-arm64
  3. Configuration Wizard
    Follow the interactive wizard to add accounts and set up the bot.

    # Optional: Load a specific config file
    ./mailbot-macos-arm64 -c ./my_config.json

Method 2: From Source

git clone https://github.com/your-username/MailBot.git
cd MailBot
python -m venv .venv && source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python main.py

πŸ“– Documentation

  • Setup Guide
    Get your Google App Password, create a Telegram Bot, and find your Chat ID.

  • Configuration
    Detailed explanation of menu options, system settings (polling, retries), and headless mode.

  • Welcome to Contribute
    Send a PR or open an issue with improvements, configuration samples, or bug reportsβ€”every contribution helps MailBot better support diverse scenarios.


πŸ–₯ Menu Overview

β–Έ Start Service      β€” Run in foreground with live logs
β–Έ Config Wizard      β€” Add / remove IMAP accounts step-by-step
β–Έ Bot Settings       β€” Set / update Telegram Bot Token & Chat ID
β–Έ System Settings    β€” Configure polling interval, retries, log level
β–Έ Test Connection    β€” Send a test message to Telegram to verify setup
β–Έ Exit               β€” Quit application

πŸ€– Telegram Commands

Command Description
/start Check if the bot is alive
/settings Open interactive settings panel (Mode/Language)
/ai (Reply to a message) Manually trigger AI analysis
/rules View or manage AI directives (Natural language add/remove)
/help Show help message

πŸ— Project Architecture

Project Architecture

πŸ— Project Structure

MailBot/
β”œβ”€β”€ main.py                 # Entry point
β”œβ”€β”€ config.json             # Auto-generated config (credentials)
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ docs/                   # Documentation (setup, config guides)
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ logger.py           # Rich logging setup
β”‚   └── helpers.py          # UI components
β”œβ”€β”€ core/                   # Core logic
β”‚   β”œβ”€β”€ models.py           # Data models
β”‚   β”œβ”€β”€ manager.py          # Service orchestration
β”‚   β”œβ”€β”€ fetcher.py          # IMAP fetching & retry logic
β”‚   β”œβ”€β”€ parser.py           # HTML body parsing
β”‚   β”œβ”€β”€ ai.py               # AI analysis & rule management
β”‚   β”œβ”€β”€ bot.py              # Telegram bot handler
β”‚   β”œβ”€β”€ rules.py            # Rule engine
β”‚   └── notifiers/          # Notification adapters (Telegram)
β”œβ”€β”€ interface/              # Interactive CLI layer
β”‚   β”œβ”€β”€ menu.py             # Main menu
β”‚   └── wizard.py           # Configuration wizards
β”œβ”€β”€ test/                   # Test files
β”œβ”€β”€ scripts/                # Utility scripts
β”œβ”€β”€ hooks/                  # Git hooks & build scripts
└── logs/                   # Application logs (auto-generated)

Acknowledgments

Special thanks to:

  • @MicrosoftCopilot
  • @claude

πŸ“„ License

MIT