Universal Mailbox Migration & 5,000 Emails/Sec in Pure Rust
The clean-room, memory-safe rewrite of email migration. Generating native 64-bit Microsoft Outlook PST containers on Linux, macOS, and Windows with zero COM DLLs, conversation thread auto-splitting, and forensic Bates stamping.
Why Rewrite mail2mail in Pure Rust?
Overcoming Python's Global Interpreter Lock, COM bitness traps, and the Windows-only ceiling.
While mail2mail succeeded in curing Outlook COM automation on Windows, Python had reached an insurmountable architectural ceiling.
Generating Outlook PST files required classic Microsoft Outlook desktop to be installed, running, and logged in via Windows OLE COM.
PST files could not be created on Linux servers, in macOS workstations, or within Docker cutover containers. Furthermore, Python's GIL and COM IPC marshaling capped throughput at ~150 emails/sec with up to 2 GB of memory usage.
Andrew Paolucci set out to achieve what was widely considered impractical: write a complete, clean-room Microsoft [MS-PST] binary container writer and reader entirely in 100% pure Rust, adhering strictly to Microsoft Open Specifications.
Inside the Pure-Rust [MS-PST] Engine
Implementing the physical Node Database (NDB) and Property Context (LTP) layers from scratch.
The Physical MS-PST Anatomy in Rust
mail2rust-pst implements the complete Microsoft 64-bit Unicode PST specification:
- Header & BREF Roots: Generates the 512-byte NDB header with magic bytes
!BDN, client signature, partial CRC-32 checksums, and root BREF pointers for NBT and BBT. - Node B-Tree (NBT) & Block B-Tree (BBT): 64-bit multi-level page trees mapping 32-bit Node IDs (NIDs) to 64-bit Block IDs (BIDs) with zero memory leaks.
- Property Context (PC 0xBC) & Table Context (TC 0x7C): Implements b-tree property storage for MAPI tags (Subject, HTML Body, Sender, Delivery Timestamps) and folder hierarchy matrices.
- Permutative & Cyclic High Encryption: Fully implements Microsoft
[MS-PST]5.1 Permutative Encoding (mpbbR) and 5.2 Cyclic Obfuscation (NDB_CRYPT_CYCLIC) with dynamic block-level key rotation (w = key ^ (key >> 16)) and store password CRC verification (PidTagPstPassword).
The 10-Crate Cargo Workspace
Strictly decoupled crates ensuring zero circular dependencies and maximum testability.
mail2rust-core
RFC 5322 MIME decoder, vCard (RFC 6350) and iCalendar (RFC 5545) parsers, and magic byte file sniffers.
mail2rust-pst
Pure-Rust MS-PST writer/reader, NBT/BBT B-Trees, mpbbR/cyclic ciphers, and container validator.
mail2rust-eml
Zero-copy EML file hierarchy exporter supporting folder, year, month, and flat layout modes.
mail2rust-mbox
High-throughput RFC 4155 / mboxrd exporter with byte-exact >From escaping and direct gzip streaming.
mail2rust-filter
Case-insensitive folder glob matching, timezone-aware date range filtering, and multi-mode deduplication.
mail2rust-forensics
Legal hold compliance, sequential Bates stamping, and RFC 6234 root Merkle tree hash digests.
mail2rust-sync
ACID JSON sync checkpoints and folder high-watermark UID tracking for instant incremental delta cutovers.
mail2rust-imap
Pure-Rust direct IMAP client over TLS/SSL with non-destructive BODY.PEEK[] live mailbox ingestion.
mail2rust-cli
Unified native CLI tool with subcommands (pst, eml, mbox, imap, audit, gui).
mail2rust-gui
Classic Win32 / MMC 3-pane administrative workbench built in 100% pure Rust (zero Electron, zero Webview).
Capabilities That Outperformed Python
Advanced features introduced in mail2rust that go far beyond standard converters.
Conversation Thread Auto-Splitter
Instead of blindly cutting PSTs at 15 GB and severing active discussions, mail2rust groups replies by Thread-Index and References so threads remain in the same volume.
Forensic eDiscovery & Bates Stamping
Applies sequential alphanumeric Bates stamps (e.g. CASE-2026-000100) and generates RFC 6234 Merkle root digests for cryptographic courtroom chain-of-custody.
Direct Live IMAP/TLS Streaming
Ingests mail directly from live Gmail, Exchange, or Fastmail servers over TLS with BODY.PEEK[], preserving unread status on the server without side effects.
Contacts & Calendars Ingestion
Converts vCard (.vcf) and iCalendar (.ics) files into native Outlook IPM.Contact and IPM.Appointment items inside dedicated PST folders.
70,000+ Mutational Fuzz Tests
Deterministic PRNG fuzzing running 70,000+ iterations across malformed MIME headers, truncated CFB sectors, and corrupt B-Trees with 0 panics or crashes.
Single Standalone Static Binary
Compiles down to an independent static executable with no external runtimes. Ready to drop onto any server or workstation.
Classic Win32 MMC Visual Walkthrough
A 100% pure-Rust administrative console (egui/eframe) with zero Electron or WebView overhead. Click any screenshot to enlarge.
Classic MMC 3-Pane Main Workbench
Sunken TreeView with folder item counters, sortable ListView, and tabbed Property Sheet.
Live IMAP/TLS Ingestion
Direct streaming from Gmail/Exchange over TLS with non-destructive BODY.PEEK[].
Universal Scope & Target Export
Selective export for checked items, active queries, or full mailboxes into PST, MBOX, or EML.
Thread-Clustering Auto-Splitter
Preserves conversation threads intact inside the same volume when auto-splitting.
Raw MAPI & Hex Stream Inspector
Inspect low-level MAPI tags, transport headers, and binary stream payloads.
eDiscovery Forensics & Bates Stamping
Apply sequential alphanumeric Bates stamps and cryptographic SHA-256 digests.
Chain-of-Custody Compliance Certificate
Courtroom-ready audit certificates detailing root Merkle tree hashes and byte counts.
10-Crate Rust Workspace Architecture
Modular workspace design ensuring testability and cross-platform compilation.
Pre-Compiled Release Packages
Self-contained native executables compiled for all major operating systems.
Windows (64-Bit)
Includes mail2rust.exe CLI and the mail2rust-gui.exe workbench.
Linux (64-Bit)
Standalone static binary for Ubuntu, Debian, RHEL, and Docker containers.
macOS Apple Silicon
Native ARM64 release optimized for modern Apple Silicon Mac computers.
macOS Intel (64-Bit)
Compiled for Intel-based Mac workstations running macOS Catalina or newer.