An open-source email archiving system built with Laravel and React. This project aims to provide GoBD-compliant email archiving for German businesses.
- IMAP Integration - Connect multiple IMAP accounts (Gmail, Outlook, custom servers)
- Automatic Syncing - Scheduled email fetching with configurable intervals (15min, hourly, daily, weekly)
- Deduplication - Attachment deduplication to reduce storage usage
- Compression - Automatic gzip compression for emails over 10KB
- BCC Mapping - Handles internal vs. external email classification
- SHA256 Checksums - Every email stored with cryptographic hash
- Tamper Detection - Hash verification to detect modifications
- Encrypted Credentials - IMAP passwords encrypted at rest using Laravel encryption
- Audit Logging - Database logging of all system actions
- Role-Based Access - Admin and user roles with different permissions
- Full-Text Search - Optional Meilisearch integration for fast searching
- Database Search - Fallback search using MySQL/PostgreSQL full-text search
- Filtering - Filter emails by sender, recipient, subject, date range
- Access Control - Users can only access emails where they are sender or recipient
- Individual Downloads - Download emails as .eml files
- Bulk Export - Export all emails or date ranges as ZIP archives
- XML Metadata - Exports include XML index files
- CSV Support - Machine-readable CSV format included in exports
- Dark Mode - Light/dark theme support
- Responsive Design - Works on desktop, tablet, and mobile
- TypeScript - Type-safe React frontend with Inertia.js
- Real-Time Stats - Dashboard with email counts and storage statistics
- PHP 8.3+
- Composer 2.0+
- Node.js 20+
- MySQL 8.0+ or PostgreSQL 14+
- Meilisearch (optional, for full-text search)
# Clone repository
git clone https://github.com/philharmonie/mailarchive.git
cd mailarchive
# Install dependencies
composer install
npm install
# Environment configuration
cp .env.example .env
php artisan key:generate
# Configure database in .env
# DB_CONNECTION=mysql
# DB_HOST=127.0.0.1
# DB_DATABASE=mailarchive
# DB_USERNAME=root
# DB_PASSWORD=
# Run migrations with test user
php artisan migrate --seed
# Build frontend
npm run build
# Start server
php artisan serveLogin at http://localhost:8000:
- Email:
test@example.com - Password:
password
# Install Meilisearch
curl -L https://install.meilisearch.com | sh
# Start Meilisearch
./meilisearch --master-key=YOUR_MASTER_KEY
# Configure in .env
SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=YOUR_MASTER_KEY
# Index existing emails
php artisan scout:import "App\Models\Email"# Optimize
composer install --optimize-autoloader --no-dev
npm run build
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Queue worker
php artisan queue:work --daemon
# Scheduler (add to crontab)
* * * * * cd /path-to-project && php artisan schedule:run >> /dev/null 2>&1- Navigate to IMAP Accounts (admin only)
- Add account with credentials:
- Host:
imap.gmail.com:993(Gmail),outlook.office365.com:993(Outlook), or custom - Username: Email address
- Password: IMAP password or app-specific password
- SSL: Enabled for port 993
- Host:
- Set sync interval
- Test connection
To properly classify internal emails, create a BCC map table in your database listing internal email addresses.
- Add/edit/delete IMAP accounts
- View system-wide statistics
- Access audit logs
- View all accounts and email counts
- Search and filter archived emails
- View email content and attachments
- Download individual emails as .eml files
- Export emails to ZIP archives
# Run all tests
php artisan test
# Run specific test
php artisan test --filter=EmailArchivingTest
# With coverage (requires Xdebug)
php artisan test --coverageContributions are welcome! This project aims to build a robust, GoBD-compliant email archiving solution.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run tests:
php artisan test - Run linter:
vendor/bin/pint - Commit:
git commit -m 'Add feature' - Push:
git push origin feature/your-feature - Open a Pull Request
- Follow PSR-12 coding standards (enforced by Pint)
- Write tests for new features
- Update documentation
- Keep commits atomic and descriptive
- All tests must pass
- GoBD Compliance Certification - Legal review and certification
- Retention Policies - Automatic deletion after retention periods
- Advanced Export Formats - MBOX, PST support
- Email Parsing - Improved handling of edge cases
- Performance - Optimization for large archives (millions of emails)
- Documentation - User guides, API documentation
- Legal review of compliance requirements
- Implement retention period enforcement
- Enhanced audit trail with complete change history
- Export format validation and certification
- Documentation for tax auditors
- S3/Object storage backend
- Microsoft 365 Graph API integration
- Multi-tenancy support
- RESTful API
- Webhook notifications
- Advanced search operators
- Horizontal scaling support
- Read replicas for search
- Background job optimization
- Monitoring and alerting
- Backup/restore functionality
- Backend: Laravel 12, PHP 8.3
- Frontend: React 19, TypeScript, Inertia.js 2.0, Tailwind CSS 4
- Database: MySQL 8.0+ / PostgreSQL 14+
- Search: Meilisearch (optional) or database full-text search
- Queue: Laravel Queue (database/redis)
- Email: Webklex PHP-IMAP library
This project is licensed under the Non-Commercial Open Source License.
Permitted:
- Personal, educational, or internal business use
- Modification and adaptation
- Study and learning
Prohibited:
- Commercial sale or SaaS offerings
- Use in commercial products without permission
- Removing license/copyright notices
See LICENSE.md for details. For commercial licensing, please contact the project maintainers.
Please report security vulnerabilities privately via GitHub Security Advisories or email the project maintainers. Do not open public issues for security bugs.
See SECURITY.md for details.
- Laravel - PHP framework
- Inertia.js - Modern monolith approach
- shadcn/ui - UI components
- Webklex/php-imap - IMAP library
- Issues: GitHub Issues
- Discussions: Use issues for questions and feature requests