Skip to content

Divi76h/uOttaMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ง uOttaMail - AI-Powered Inbox Firewall

Built for uOttaHack 8 | Solace Agent Mesh + Solace PubSub+ + Django + React

An intelligent email security system that uses multiple AI agents to analyze incoming emails in real-time for spam detection, priority classification, tone analysis, action item extraction, and malicious URL scanning.

Python Django React Solace AWS Docker


โœจ Features

  • ๐Ÿšซ Spam Detection - AI-powered spam and phishing classification
  • ๐ŸŽฏ Priority Classification - Automatic urgency scoring (Urgent/High/Medium/Low)
  • ๐Ÿ“ Smart Summaries - One-line AI summaries for quick scanning
  • ๐Ÿ˜Š Tone Analysis - Sentiment detection (Professional, Friendly, Urgent, etc.)
  • โœ… Action Item Extraction - Automatically extracts tasks with due dates
  • ๐Ÿ”— URL Security Scanning - VirusTotal integration for malicious link detection
  • ๐Ÿ’ฌ AI Chat Interface - Ask questions about your emails in natural language
  • โšก Real-time Updates - Server-Sent Events (SSE) for instant UI updates

๐Ÿ—๏ธ Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   React UI  โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚  Django Backend  โ”‚โ”€โ”€โ”€โ”€โ–บโ”‚       Solace PubSub+ Broker     โ”‚
โ”‚  (Vite)     โ”‚ SSE โ”‚  (DRF + JWT)     โ”‚MQTT โ”‚                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚                              โ”‚
                              โ”‚                              โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  PostgreSQL 16    โ”‚     โ”‚   Solace Agent Mesh (SAM)       โ”‚
                    โ”‚  + Redis 7        โ”‚     โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚  โ”‚ Event   โ”‚ โ”‚   AI Agents     โ”‚โ”‚
                                              โ”‚  โ”‚ Mesh GW โ”‚โ–บโ”‚ โ€ข SpamAgent     โ”‚โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚  โ”‚         โ”‚ โ”‚ โ€ข PriorityAgent โ”‚โ”‚
                    โ”‚  Django Consumer  โ”‚โ—„โ”€โ”€โ”€โ”€โ”ค  โ”‚         โ”‚ โ”‚ โ€ข SummaryAgent  โ”‚โ”‚
                    โ”‚  (MQTT Subscriber)โ”‚     โ”‚  โ”‚         โ”‚ โ”‚ โ€ข ToneAnalyzer  โ”‚โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚  โ”‚         โ”‚ โ”‚ โ€ข ActionItems   โ”‚โ”‚
                                              โ”‚  โ”‚         โ”‚ โ”‚ โ€ข URLScanner    โ”‚โ”‚
                                              โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ€ข QueryAgent    โ”‚โ”‚
                                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                              โ”‚
                                              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                              โ”‚        External Services      โ”‚
                                              โ”‚  โ€ข AWS Bedrock (Claude 3.5)   โ”‚
                                              โ”‚  โ€ข VirusTotal API (MCP)       โ”‚
                                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

How it works:

  1. Django publishes new emails to Solace topics via MQTT
  2. SAM's Event Mesh Gateway fans out each email to 6+ specialist AI agents in parallel
  3. Each agent analyzes the email and publishes results to its own topic
  4. Django Consumer subscribes to all result topics and updates the database
  5. SSE pushes real-time updates to the React UI

๐Ÿ“ Project Structure

uOttaMail/
โ”œโ”€โ”€ backend/                 # Django REST API + MQTT Consumer
โ”‚   โ”œโ”€โ”€ api/                 # DRF views, models, serializers
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # Email, User, ActionItem models
โ”‚   โ”‚   โ”œโ”€โ”€ views.py         # REST endpoints + SSE
โ”‚   โ”‚   โ””โ”€โ”€ solace_mqtt.py   # MQTT publisher client
โ”‚   โ”œโ”€โ”€ inboxfirewall/       # Django project settings
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ frontend/                # React + Vite UI
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx          # Main application component
โ”‚   โ”‚   โ””โ”€โ”€ index.css        # Styling
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ sam/                     # Solace Agent Mesh configuration
โ”‚   โ”œโ”€โ”€ configs/
โ”‚   โ”‚   โ”œโ”€โ”€ agents/          # AI agent definitions
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ spam_agent.yaml
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ priority_agent.yaml
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ summary_agent.yaml
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ email_tone_analyzer.yaml
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ action_items_agent.yaml
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ url-scanner.yaml
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ email_query_agent.yaml
โ”‚   โ”‚   โ”œโ”€โ”€ gateways/        # Event Mesh Gateway configs
โ”‚   โ”‚   โ””โ”€โ”€ shared_config.yaml
โ”‚   โ””โ”€โ”€ src/inbox_agents/    # Custom Python tools
โ”œโ”€โ”€ docker-compose.yml       # Full stack orchestration
โ”œโ”€โ”€ .env.example             # Environment template
โ””โ”€โ”€ README.md

๐Ÿš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • AWS account with Bedrock access (Claude 3.5 Haiku enabled)
  • VirusTotal API key (free tier works)

1. Clone & Configure

git https://github.com/Divi76h/uOttaMail.git
cd uOttaMail

# Copy environment files
cp .env.example .env
cp sam/.env.example sam/.env

2. Set Environment Variables

Edit sam/.env:

LLM_SERVICE_API_KEY=<your-aws-access-key>
LLM_SERVICE_API_KEY_SECRET=<your-aws-secret-key>
LLM_SERVICE_REGION=us-east-1
VIRUSTOTAL_API_KEY=<your-virustotal-key>

3. Start All Services

docker compose up --build

Note: First run takes a few minutes as SAM installs the Event Mesh Gateway plugin.

4. Access the Application

Service URL Credentials
React UI http://localhost:5173 Register new user
Django API http://localhost:8001/api/ JWT Auth
Solace Broker Manager http://localhost:8080 admin / admin

๐ŸŽฎ How to Demo

  1. Register two users in the UI (e.g., alice and bob)
  2. Login as Alice and send an email to Bob
  3. Login as Bob - watch the email appear with AI analysis badges:
    • ๐ŸŸข Priority badge (Urgent/High/Medium/Low)
    • ๐Ÿ›ก๏ธ Spam status (Legitimate/Suspicious/Spam)
    • ๐Ÿ“ One-line summary
    • ๐Ÿ˜Š Tone indicator
    • โœ… Extracted action items
    • ๐Ÿ”— URL safety status
  4. Try the AI Chat - Ask "What emails mention deadlines?"

๐Ÿ“จ Topic Architecture

solace-broker/
โ”œโ”€โ”€ email/
โ”‚   โ”œโ”€โ”€ new/{user_id}/{email_id}           # Trigger for all agents
โ”‚   โ”œโ”€โ”€ chat/{user_id}/{session_id}        # AI chat queries
โ”‚   โ”œโ”€โ”€ priority/{user_id}/{email_id}      # Priority results
โ”‚   โ”œโ”€โ”€ spam/{user_id}/{email_id}          # Spam detection results
โ”‚   โ”œโ”€โ”€ summary/{user_id}/{email_id}       # Summary results
โ”‚   โ”œโ”€โ”€ tone/{user_id}/{email_id}          # Tone analysis results
โ”‚   โ”œโ”€โ”€ action_items/{user_id}/{email_id}  # Action items results
โ”‚   โ””โ”€โ”€ url_scan/{user_id}/{email_id}      # URL scan results

๐Ÿ› ๏ธ Technology Stack

Layer Technology Purpose
Frontend React 18 + Vite Modern UI with hot reload
Backend Django 5.1 + DRF REST API framework
Auth SimpleJWT Token-based authentication
Database PostgreSQL 16 Primary data store
Cache Redis 7 Session management
Message Broker Solace PubSub+ Event-driven messaging
AI Framework Solace Agent Mesh Multi-agent orchestration
LLM AWS Bedrock (Claude 3.5 Haiku) AI inference
Security API VirusTotal (MCP) Malicious URL detection
Orchestration Docker Compose Container management

๐Ÿ”ง Development

Running Individual Services

# Backend only
cd backend && python manage.py runserver

# Frontend only  
cd frontend && npm run dev

# View SAM logs
docker logs -f inbox-sam

Useful Commands

# Restart just SAM (after config changes)
docker compose restart sam

# View all container logs
docker compose logs -f

# Reset database (caution: deletes all data)
docker compose down -v
docker compose up --build

๐Ÿ› Troubleshooting

SAM not processing emails?

Check for broker queue limits in Solace Manager (http://localhost:8080):

Queues > Look for queues starting with "#P2P"
If count is ~100, delete old queues and restart SAM

Database connection errors?

docker compose down
docker compose up -d postgres
# Wait for healthy status, then:
docker compose up

LLM not responding?

Verify AWS credentials and ensure Claude 3.5 Haiku is enabled in your Bedrock region.


๐Ÿ“„ License

MIT License


About

An intelligent email security system that uses multiple AI agents to analyze incoming emails in real-time for spam detection, priority classification, tone analysis, action item extraction, and malicious URL scanning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors