Your AI Mail Management Agent
An intelligent assistant that understands, summarizes, and processes your emails according to your rules.
- 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.
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.
-
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
-
Run Application
Execute the binary. Theconfig.jsonwill 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
-
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
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-
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.
βΈ 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
| 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 |
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)
Special thanks to:
- @MicrosoftCopilot
- @claude
MIT

