MailDB
Comprehensive email database system for storing, managing, and searching email data with AI-powered features. Includes command-line import tools, REST API server, web interface, and intelligent email summarization capabilities.
Key Features
Email Import & Management
Command-line tools for importing emails from .mbox files with progress tracking and error handling.
- Batch import from .mbox files
- Real-time progress tracking
- Attachment handling with optional skip
- Error recovery and reporting
- H2 database with optimized schema
- Full-text search indexing
AI-Powered Analysis
Intelligent email summarization and analysis using multiple AI providers for enhanced email management.
- Multi-provider AI support (OpenAI, Anthropic, Google, etc.)
- Individual and batch email summarization
- Goal-oriented summarization objectives
- AI-powered search with intelligent filtering
- Configurable AI models and settings
- Privacy-focused local processing
Advanced Search & Organization
Powerful search capabilities with regex support, label management, and comprehensive filtering options.
- Advanced search with multiple criteria
- Regular expression pattern matching
- Custom label system for organization
- Date range and attachment filtering
- Bulk operations and ZIP downloads
- Pagination for large result sets
Web Interface & API
Modern web interface and comprehensive REST API for programmatic access and integration.
- Intuitive web-based email viewer
- RESTful API with comprehensive endpoints
- Attachment preview and download
- Real-time import progress tracking
- Settings management interface
- API documentation and testing tools
Getting Started
Download and Setup
- Download the application JAR file from the releases page
- Ensure you have Java 11+ installed
- Create a directory for database files
- Optionally configure AI provider API keys
Basic Usage
# Import emails from .mbox file
java -jar maildb.jar import gmail-export.mbox
# Start the web server
java -jar maildb.jar server
# Access web interface
open http://localhost:8080
Production Deployment
# Optimize JVM for large datasets
java -Xmx4g -XX:+UseG1GC -jar maildb.jar server
# Configure as systemd service
sudo systemctl enable maildb
sudo systemctl start maildb
Quick Example
Import Your Email Data
# Basic import from .mbox file
java -jar maildb.jar import gmail-export.mbox
# Import without attachments (faster)
java -jar maildb.jar import --skip-attachments large-archive.mbox
# Start the server
java -jar maildb.jar server
Web Interface Usage
- Access Interface: Open http://localhost:8080
- Search Emails: Use advanced search with multiple criteria
- AI Features: Configure API keys in Settings for summarization
- Label Management: Organize emails with custom labels
- Bulk Operations: Download multiple emails as ZIP archives
API Examples
# Search emails
curl "http://localhost:8080/api/search?subject=important&from=john@example.com"
# AI summarization
curl "http://localhost:8080/api/summarize-search?subject=meeting&goal=Extract action items"
# Download attachment
curl -O -J -L http://localhost:8080/api/attachments/{emailId}/{attachmentId}
# Configure AI provider
curl -X PUT http://localhost:8080/api/settings \
-H "Content-Type: application/json" \
-d '{"name": "openai.api.key", "value": "sk-..."}'
Database Management
# Access H2 console for direct database access
open http://localhost:8080/h2-console
# JDBC URL: jdbc:h2:./maildb/maildb
# Username: sa, Password: (empty)
# Backup database
cp -r ./maildb ./maildb-backup-$(date +%Y%m%d)
Technical Details
Technologies
JavaH2 DatabaseREST APIWeb InterfaceAI IntegrationEmail Processing
Requirements
- Java 11 or higher
- 2GB RAM minimum (4GB+ recommended for large datasets)
- 1GB free disk space (more for substantial email archives)
- Optional: AI provider API keys (OpenAI, Anthropic, Google, etc.)
- SSD storage recommended for better performance
Contribute to the Project
This is an open-source project. Contributions, bug reports, and feature requests are welcome from the community.