# Email Organizer A self-hosted AI-powered email organization system that automates folder sorting, prioritization, and rule recommendations through natural language configuration. ## Core Value Proposition - **Natural Language Rules**: Define email organization logic in plain English instead of writing sieve/filter rules - **Smart Separation**: Automatically categorize marketing emails, receipts, and transactional messages - **Adaptive Intelligence**: Learns your preferences to star important emails and suggest new organizational patterns ## Technical Overview **Stack**: - Backend: Flask (Python 3.10+) - Frontend: HTMX + AlpineJS + DaisyUI (Tailwind CSS) - Database: PostgreSQL - AI: OpenAI-compatible API endpoints **Key Components**: 1. **Rule Engine**: Converts natural language rules → executable classification logic 2. **Email Processor**: Polls IMAP server, applies AI classifications, moves messages 3. **Recommendation System**: Analyzes usage patterns to suggest new folders/rules ## Getting Started ### Prerequisites - Python 3.10+ - PostgreSQL 14+ - IMAP server access ### Setup ```bash # Install dependencies pip install -r requirements.txt # Set up development environment (PostgreSQL and IMAP server) flask setup-dev # Configure environment cp .env.example .env # (Edit .env with your DB/IMAP credentials) # Initialize database flask db upgrade # Run development server flask run ``` ## Roadmap ### Milestone 1: Prototype (Current Focus) - [ ] Core infrastructure setup - [ ] Basic UI for rule configuration - [ ] Mock email processing pipeline - [ ] Database schema implementation ### Future Milestones - [ ] MVP - enter your imap server. You list out folders and rules, and once a day emails in the "Pending" folder will be reorganized. - [ ] "Import" your list of folders from your imap server - [ ] Polling every 5 minutes, working off recent emails since last poll - [ ] Label support for services like gmail - [ ] Generate config to automate integration into imap servers like dovecot or gmail or proton - [ ] Supporting auth / multi user. Admin controls the list of users, users control their folders. - [ ] Making a paid, hosted version - [ ] Auth via google / facebook / etc. - [ ] Automatically star based off of your habits ## Data Model **Users** | Column | Type | Description | |--------|------|-------------| | id | UUID | Primary key | | email | VARCHAR | Unique identifier | | password_hash | BYTEA | Argon2-hashed | | imap_config | JSONB | Encrypted server settings | **Folders** | Column | Type | Description | |--------|------|-------------| | id | UUID | Primary key | | user_id | UUID | Foreign key | | name | VARCHAR | Display name | | rule_text | TEXT | Natural language rule | | priority | INT | Processing order | ## Contributing 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/AmazingFeature`) 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request > **Note**: All new features require corresponding unit tests and documentation updates.