A production-ready demo of AI-powered email triage and automated reply generation.
MailMind AI automatically classifies incoming emails into actionable categories and generates context-aware draft replies — with zero external API dependencies. Built as a portfolio demonstration of AI-augmented workflow automation.
Live capabilities:
- 🏷️ 5-category classification — Urgent, Support Request, Sales Inquiry, Newsletter, Spam
- 🤖 AI-generated replies — Template-based with smart variable substitution
- 📊 Real-time dashboard — Category distribution chart, reply rate, priority queue
- 🚀 One-click reply — Simulated send with full audit trail
- 📱 Mobile responsive — Works on any screen size
Screenshots coming soon — run locally to see the UI
| Dashboard | Email View | Classify Form |
|---|---|---|
| (chart + inbox table) | (classification result + draft reply) | (paste/submit form) |
| Layer | Technology |
|---|---|
| Backend | Python 3.12, FastAPI |
| Templating | Jinja2 |
| Database | SQLite via SQLAlchemy |
| Styling | TailwindCSS (CDN) |
| Charts | Chart.js 4 |
| Classification | Keyword/rule engine (no API key) |
| Replies | Template-based with context extraction |
email-classifier/
├── app.py # FastAPI app, routes, startup
├── classifier.py # Email classification engine
├── responder.py # Auto-reply generator
├── database.py # SQLite models + stats queries
├── sample_emails.py # 10 demo emails + seed script
├── templates/
│ ├── base.html # Navigation, layout shell
│ ├── index.html # Email input form
│ ├── dashboard.html # Stats + email table
│ └── email.html # Classification result + reply
├── static/
│ └── style.css # Custom overrides
├── requirements.txt
└── README.md
git clone https://github.com/yourname/email-classifier.git
cd email-classifier
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtuvicorn app:app --reload --host 0.0.0.0 --port 8000Open http://localhost:8000 in your browser.
10 sample emails are automatically seeded on first run — the dashboard will have data immediately.
python sample_emails.pyThe classifier uses a weighted keyword-matching engine across 5 categories:
# Example: Urgent detection
KEYWORDS = ["urgent", "critical", "outage", "down", "asap", "emergency"]
# Subject-line keywords get 40% weight, body 60%
# Confidence scores normalized to 60-99% range for realism| Category | Triggers | Default Priority |
|---|---|---|
| Urgent | outage, critical, ASAP, down, emergency | Critical |
| Support Request | help, error, bug, not working, issue | High |
| Sales Inquiry | pricing, demo, quote, purchase, enterprise | High |
| Newsletter | unsubscribe, digest, edition, noreply | Low |
| Spam | winner, lottery, free money, guaranteed | Low |
Replies use structured templates with smart variable extraction:
- Sender name — extracted from
"First Last <email>"format - Company hint — inferred from email domain (ignores Gmail, Yahoo, etc.)
- Issue summary — first meaningful sentence from email body
- Case ID — randomly generated 5-digit reference number
- Agent name — randomly selected from a pool of realistic names
| Method | Path | Description |
|---|---|---|
| GET | / |
Email input form |
| POST | /classify |
Classify & store email |
| GET | /email/{id} |
View classified email + reply |
| POST | /email/{id}/send-reply |
Mark reply as sent |
| GET | /dashboard |
Stats dashboard |
| GET | /api/stats |
JSON stats endpoint |
| GET | /health |
Health check |
This project demonstrates:
- Customer support automation — Route tickets automatically, reduce triage time
- Sales inbox management — Flag qualified leads, draft initial responses
- Spam filtering — Reduce noise in shared inboxes
- Email analytics — Track volume, categories, response rates
- Replace keyword classifier with a real LLM (OpenAI, Anthropic, local Ollama)
- Add Gmail/Outlook OAuth integration for live inbox monitoring
- Build a webhook endpoint to receive emails from SendGrid/Mailgun
- Add Slack/Teams notifications for urgent emails
- Export classified emails to CRM (Salesforce, HubSpot)
MIT — free to use for personal and commercial projects.
Built with FastAPI + TailwindCSS · No external AI APIs required for demo