Skip to content

Architecture

LitapAI_Rohit edited this page Jul 8, 2026 · 1 revision

MailIntel AI Architecture

MailIntel AI follows a modular, layered architecture designed for maintainability, testability, and future extensibility.

The system separates user interface, business logic, intelligence modules, reporting, and workflows into independent components.


High-Level Architecture

                    RFC822 Email (.eml)
                             │
                             ▼
                   Email Parsing Engine
                             │
                             ▼
                  Investigation Workflow
                             │
        ┌────────────────────┼────────────────────┐
        │                    │                    │
        ▼                    ▼                    ▼
Authentication       Language Intelligence   URL Intelligence
        │                    │                    │
        └────────────────────┼────────────────────┘
                             ▼
                   Evidence Collection
                             │
                             ▼
                     Findings Engine
                             │
                             ▼
                 Explainable Risk Engine
                             │
                             ▼
                 Investigation Report
                   │                   │
                   ▼                   ▼
            JSON Report        Executive PDF
                   │
                   ▼
           Streamlit Dashboard

Design Principles

The architecture follows several software engineering principles.

Separation of Concerns

Each module has a single responsibility.

Examples:

  • Email Parser only parses emails.
  • Intelligence modules only analyze evidence.
  • Reporting modules only generate reports.
  • UI only presents investigation results.

This minimizes coupling between components.


Clean Architecture

The project is organized into logical layers.

Presentation Layer
        │
Application Layer
        │
Domain Logic
        │
Infrastructure

Each layer depends only on abstractions below it.


Explainable AI

Rather than generating opaque risk scores, MailIntel AI collects evidence first.

Every recommendation and risk score can be traced back to specific observations.

Example:

Finding:
Suspicious URL detected

Evidence:
http://login-security-update.example

Risk Contribution:
+20 points

This makes investigations transparent and auditable.


Core Components

Email Parser

Responsible for:

  • Reading RFC822 email files
  • Extracting headers
  • Extracting body content
  • Producing structured email objects

Authentication Analysis

Examines:

  • SPF
  • DKIM
  • DMARC

Authentication failures increase investigation risk.


URL Intelligence

Extracts URLs from the email and performs:

  • Domain extraction
  • Suspicious URL detection
  • Indicator collection

Future versions may integrate external threat intelligence.


Language Intelligence

Analyzes textual content for phishing characteristics.

Examples include:

  • Urgency
  • Credential requests
  • Financial requests
  • Social engineering language

Evidence Engine

Collects structured evidence generated by all intelligence modules.

Evidence becomes the foundation for investigation findings.


Findings Engine

Converts evidence into human-readable findings.

Example:

High Risk

Multiple authentication failures detected.

Several suspicious URLs identified.

Language indicates credential harvesting attempt.

Risk Engine

Calculates an explainable investigation score.

The score is derived from accumulated evidence rather than arbitrary weighting.


Report Builder

Generates:

  • JSON Investigation Report
  • Executive PDF Report

Both reports contain identical investigation results in different formats.


User Interface

The Streamlit dashboard provides:

  • Investigation Overview
  • Risk Profile
  • Evidence Explorer
  • Language Analysis
  • Investigation Reports
  • PDF Download
  • JSON Download

Data Flow

Email Upload

↓

Email Parsing

↓

Evidence Collection

↓

Intelligence Modules

↓

Findings Generation

↓

Risk Calculation

↓

Report Generation

↓

Dashboard

Why This Architecture?

The architecture was chosen to achieve the following goals:

  • Modular development
  • Independent testing
  • Easy future enhancements
  • Explainable investigations
  • Enterprise-ready structure

Each component can evolve independently without affecting unrelated parts of the system.


Future Evolution

Planned architectural enhancements include:

  • FastAPI backend
  • React frontend
  • PostgreSQL persistence
  • User authentication
  • Case management
  • Threat intelligence APIs
  • Multi-user investigations
  • Background processing
  • Batch email analysis

The current architecture was designed to support these future capabilities with minimal refactoring.

Clone this wiki locally