An unbranded, self-hosted email tracker and Mailtrack alternative. Features real-time Telegram open alerts, anti-cache defense, heuristic bot filtering, and rich telemetry (IP location, device breakdown, and forwarding detection).
When sending important emails (like project proposals, outreach, or applications), it is helpful to know if the message arrived and was read. This project provides:
- Invisible Pixel Tracking: Inserts a 1x1 transparent image in your email to detect when it gets opened.
- Bot and Proxy Detection: Uses
crawlerdetectanduser-agentsto help tell apart automated security crawlers (like Mimecast or Proofpoint), privacy proxies (like Gmail or Apple Mail), and real human opens. - Telegram Notifications: Sends a message to your Telegram chat as soon as an open event is detected.
- Interactive Bot & REST API: Create tracked emails either using a Telegram bot wizard (
/formator/new) or directly through HTTP endpoints. - Structured Logs: Simple JSON logging with file rotation to help monitor your server.
graph TD
subgraph Delivery ["Services"]
TrackerApp["FastAPI Tracker (services/tracker)"]
BotApp["Telegram Bot (services/bot)"]
end
subgraph UseCases ["Core Logic"]
CreateUC["CreateEmailUseCase"]
RecordUC["RecordOpenUseCase"]
ListUC["ListEmailsUseCase"]
DeleteUC["DeleteEmailUseCase"]
end
subgraph Domain ["Domain & Data"]
Entities["Email & Event Models"]
RepoPort["Database Repository"]
NotifierPort["Telegram Notifier"]
Heuristics["Bot & Proxy Classifier"]
end
subgraph FormatterPkg ["HTML Formatter"]
Engine["Template & Pixel Injector"]
end
TrackerApp --> UseCases
BotApp --> UseCases
UseCases --> Domain
UseCases --> FormatterPkg
UseCases --> RepoPort
UseCases --> NotifierPort
RecordUC --> Heuristics
- Python >= 3.11
uv(recommended) or standardpip
Copy .env.example to .env:
cp .env.example .envConfigure your .env variables:
BASE_URL=http://localhost:8000
DATABASE_URL=sqlite+aiosqlite:///tracker.db
TELEGRAM_BOT_TOKEN=your_token_from_botfather
TELEGRAM_BOT_MODE=auto
API_KEY=your_optional_secret_key
RATE_LIMIT_ENABLED=true
LOG_FILE=logs/app.log
PORT=8000
HOST=0.0.0.0Multi-User Ready:
TELEGRAM_CHAT_IDis no longer needed! MailBlinker automatically captures each user's Telegram ID dynamically, delivering private open alerts and personal/statsto every user independently.
uv sync --all-packagesuv run alembic upgrade head(Supports SQLite, PostgreSQL, and CockroachDB Serverless)
uv run python run.pyThis starts both the FastAPI tracker on port 8000 and the Telegram bot process.
docker compose up -d --buildThis builds and runs MailBlinker in the background with persistent storage in ./data/.
/start- Starts the bot and displays the commands guide./new <Title> | <RecipientEmail>- Quickly creates a tracked email link (e.g./new Proposal | client@example.com)./format- Interactive 5-step wizard to compose a formatted email with links./stats- View telemetry and open history for your personal tracked emails./cancel- Abort the active/formatcomposer at any time./help- Helpful tips on pasting formatted HTML into Gmail and Outlook.
- Tap ⚡ Fast Track or send
/newin Telegram to generate your tracked email. - Open the generated
.htmlattachment in a browser. - Copy and paste the rendered email into your Gmail or Outlook compose box.
- Send your email. When opened, the bot pings you instantly with rich telemetry (device, reading delay, location).
GET /track/{token}.gif
- Returns the 1x1 transparent image and records the open event.
POST /api/emails
{
"title": "Project Proposal",
"recipient_email": "client@example.com",
"recipient_name": "Sarah",
"body_text": "Here is the proposal we discussed.",
"links": [
{ "text": "View Document", "url": "https://example.com/doc.pdf" }
]
}GET /api/emails
- Returns tracked emails and their recorded open events.
DELETE /api/emails/{id}
- Deletes an email and its history.
GET /
- Checks if the server is running.
This project uses Alembic to manage database changes:
- Create migration:
uv run alembic revision --autogenerate -m "message"- Apply migrations:
uv run alembic upgrade head- Rollback one migration:
uv run alembic downgrade -1- Lint with Ruff:
uv run --with ruff ruff check .- Format code with Ruff:
uv run --with ruff ruff format .- Type check with Pyright:
uv run --with pyright pyright- Run test suite with Pytest:
uv run pytestThis project is licensed under the Business Source License 1.1 (BSL 1.1).
- Free for Personal & Self-Hosted Use: You are free to view, study, modify, and self-host MailBlinker for personal, educational, and internal non-commercial use.
- Commercial Protection: Providing MailBlinker as a paid commercial service or SaaS to third parties requires a commercial license from the author.
- Conversion: Automatically converts to open-source GNU AGPLv3 after the change date.
See the LICENSE file for complete legal terms.
