feat: normalize emails

This commit is contained in:
2025-12-04 11:59:30 +01:00
parent 4482c4041e
commit 610d10fd1e
12 changed files with 683 additions and 18 deletions
+35 -4
View File
@@ -4,10 +4,14 @@ A Rust application that downloads emails from a POP3 server and imports them int
## Features
- Downloads all emails from a POP3 server
- Imports emails to the INBOX of an IMAP server
- **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
@@ -35,8 +39,35 @@ A Rust application that downloads emails from a POP3 server and imports them int
## Usage
Run the application:
### POP3 to IMAP Migration
Run the main importer to migrate emails from POP3 to IMAP:
```bash
cargo run
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