herel e0b0c5e964 fix: add X-WS-* header detection and attachment test
- Detect X-WS-* headers (e.g., X-WS-Attachment-UUID) as MIME headers
  to ensure attachment headers like Content-Type and Content-Disposition
  get normalized properly
- Add test case for attachment header normalization
- Bump version to 0.5.0

The normalization fixes malformed continuation lines in attachment
headers generated by Infomaniak webmail, where lines like
"name=file.pdf" are missing the required leading whitespace.
2025-12-10 15:22:55 +01:00
2025-11-20 14:59:04 +01:00
2025-11-20 14:59:04 +01:00
2025-12-04 11:59:30 +01:00
2025-12-04 11:59:30 +01:00
2025-12-04 11:59:30 +01:00

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:

    cp .env.example .env
    
  2. Edit .env with your server credentials:

    # 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:

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:

# 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
S
Description
Rust program to import emails from pop3 server to imap server
Readme 88 KiB
Languages
Rust 90.5%
Makefile 5.6%
Dockerfile 3.9%