Skip to content

apiwishboon-spec/CortexMail

Repository files navigation

CortexMail Logo

CortexMail 🧠

"The cortex is the outer layer of the brain. It’s where the good stuff happens: thinking, language, decision-making, context, judgment."

CortexMail isn't just another auto-reply bot. It's a cognitive email assistant that understands context, interprets intent, and makes decisions like a thinking entity. It doesn't just react; it processes.

A production-ready AI-powered email intelligence system with real SMTP/IMAP integration, context-aware cognition, and a robust Neobrutalist web interface.

🌟 Features

  • 🧠 Context-Aware AI Engine - Understands email topics (billing, technical, scheduling) and generates custom responses.
  • 🦙 Ollama Integration - Support for local LLMs like Llama 3 and Mistral for high-quality, human-like replies.
  • 📧 Full Email Integration - IMAP/SMTP support for Gmail, Outlook, Yahoo, and more.
  • Real-time Monitoring - Automatic background inbox checking with configurable intervals.
  • 💾 Permanent History - Processed emails and history are persisted locally, surviving server restarts.
  • 🛡️ Thread-Safe Operations - Robust connection management handling concurrent manual and automatic checks.
  • 🎨 Neobrutalist UI/UX - Bold, high-contrast dashboard built with Bootswatch Brite and Bootstrap 5.
  • ⚖️ Apache License 2.0 - Fully open-source and ready for professional use.

📸 Preview

Login Page

Login Page

Dashboard

Dashboard


🚀 Quick Start

Prerequisites

🚀 Quick Start

1. Setup & Install

# Clone Repository
git clone https://github.com/apiwishboon-spec/AI-Email-Auto-Reply-System.git
cd AI-Email-Auto-Reply-System

# Create Virtual Environment & Install
# Linux/macOS:
python3 -m venv venv && source venv/bin/activate && pip install -r requirements.txt

# Windows (PowerShell):
python -m venv venv; .\venv\Scripts\activate; pip install -r requirements.txt

2. Configure

cp .env.example .env  # Windows: copy .env.example .env
# Edit .env to set preferences (Optional)

💻 Usage

  1. Launch the Server

    python app.py

    The application will be accessible at http://localhost:5001.

  2. Login Enter your email and the App Password you generated.

  3. Start Monitoring Enable Auto-Reply from the dashboard. The system will start checking your inbox every 30 seconds (default).


🏛️ Architecture

graph TD
    User((User)) -->|Browser| WebUI[Flask Web UI]
    WebUI -->|API| App[Flask app.py]
    App -->|Manage| Monitor[Monitor Service]
    Monitor -->|Check| EmailSvc[Email Service]
    EmailSvc -->|Read/Send| Provider[Email Provider]
    EmailSvc -->|Analyze| AI[Context-Aware AI]
    AI -->|Generate| Template[Email Template Gen]
    AI -->|Optional| Ollama[Local LLM / Llama 3]
    Template --> EmailSvc
Loading

🛠️ Technology Stack

  • Backend: Python, Flask, Flask-CORS
  • Email Protocol: IMAP (imaplib) & SMTP (smtplib)
  • AI Core: Custom AI Processor + Optional Ollama (Requests)
  • Frontend: Bootstrap 5, Bootswatch Brite (Neobrutalism), Vanilla Javascript
  • Persistence: Local JSON Storage (Thread-safe)

🔒 Security & Best Practices

  • App Passwords: Never use your primary account password.
  • Environment Safety: The .env and processed_history.json files are git-ignored to protect your data.
  • Local AI: Using Ollama keeps your email content entirely on your own machine.
  • Persistence: Processed email IDs are tracked to prevent double-replies.

📄 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.


👨‍💻 Developed By

APIWISH ANUTARAVANICHKUL © 2025 All rights reserved.

About

CortexMail is an open-source AI email assistant that reads inboxes and generates context-aware replies automatically.

Resources

License

Security policy

Stars

Watchers

Forks

Contributors