# POP to IMAP Importer A Rust application that downloads emails from a POP3 server and imports them into an IMAP server's INBOX. ## Features - **POP3 to IMAP Migration**: Downloads all emails from a POP3 server and imports them to IMAP - **IMAP Email Normalization**: Fix existing malformed emails already in your IMAP inbox - Secure TLS connections - Environment-based configuration - Automatic email header normalization (RFC 5322 compliance) - Fixes improperly formatted header continuation lines - Ensures continuation lines start with proper whitespace - Safe operation with dry-run mode and confirmation prompts ## Setup 1. Copy `.env.example` to `.env`: ```bash cp .env.example .env ``` 2. Edit `.env` with your server credentials: ```env # POP3 Source Server Configuration POP3_HOST=pop.example.com POP3_PORT=995 POP3_USERNAME=your_pop3_username POP3_PASSWORD=your_pop3_password # IMAP Destination Server Configuration IMAP_HOST=imap.example.com IMAP_PORT=993 IMAP_USERNAME=your_imap_username IMAP_PASSWORD=your_imap_password ``` ## Usage ### POP3 to IMAP Migration Run the main importer to migrate emails from POP3 to IMAP: ```bash cargo run --bin pop-to-imap # or in release mode cargo run --release --bin pop-to-imap ``` ### Normalize Existing IMAP Emails If you already have malformed emails in your IMAP inbox, use the normalization tool: ```bash # Dry run to see what would be changed cargo run --release --bin normalize-imap -- --dry-run # Actually normalize the emails (will prompt for confirmation) cargo run --release --bin normalize-imap # Skip confirmation prompt cargo run --release --bin normalize-imap --yes ``` **Note:** The normalize-imap tool will: 1. Fetch all emails from your IMAP INBOX 2. Analyze which emails have malformed headers 3. Show you a summary of what needs to be fixed 4. Delete and re-import only the emails that need normalization 5. Keep emails that are already RFC 5322 compliant unchanged