How does this MBOX viewer open multi-gigabyte mail archives?
To open an MBOX file on macOS, Windows, or Linux without installing Thunderbird, this browser-based MBOX viewer scans archives inside a Comlink Web Worker using 4 MiB byte-offset chunks (STREAM_CHUNK_SIZE). Because it stores byte slices and probes only 24 KB per header (HEADER_SCAN_LIMIT), multi-gigabyte Google Takeout dumps become searchable locally without network transfers.
Rather than unpacking every email attachment up front, lazy indexing keeps full message bodies unread on disk until selected. You can test takeout-sample.mbox immediately with Load sample MBOX, which contains three messages, a text attachment, and a stripped tracking pixel, or reset the workspace anytime with Change MBOX.
Under the RFC 4155 mailbox format specification, concatenated mailboxes split along unindented From boundaries while single .eml files fall back cleanly to byte offset 0. For a single standalone .eml file without an archive container, use EML to PDF export without uploading raw mail.
Parsing Thunderbird MBOX boundaries and mboxrd From lines
MBOX files store mail sequentially without a central directory, so delimiter parsing controls archive integrity. Inside the worker, isFromSeparatorLine checks unindented From lines measuring 10 to 511 bytes containing a sender and ctime or ISO timestamp, ignoring indented body prose.
RFC 4155 separator detection and mboxrd unescaping
Unix writers prepend > to body lines starting with From to prevent false message splits. As noted in the Library of Congress MBOX preservation notes, reversible mboxrd escaping adds one > to any line matching ^>(>*From ).
Clicking a message invokes unescapeMboxrdMessage after the \r?\n\r?\n header divider, stripping one leading > cleanly while keeping headers unchanged. Proprietary Microsoft Outlook .msg containers use binary OLE storage instead of Unix text delimiters and need a separate reader to open Outlook MSG container files locally.
MIME headers, Gmail labels, and ZIP safety limits
The 24 KB probe extracts Subject, From, To, Date, Message-ID, X-Gmail-Labels, and a 140-character snippet, decoding encoded tokens per the RFC 2047 MIME header encoding standard and RFC 2231 filename continuations.
Extracted X-Gmail-Labels populate All labels filter pills alongside Search mailbox messages and Has attachments. Zipped Takeout inputs unpacked via extractZipArchive ignore __MACOSX/ and .DS_Store noise while enforcing 5,000 entries, 250 MB single-file, and 500 MB cumulative uncompressed caps before scanning nested .mbox or .mbx files.
Sanitizing email HTML and blocking remote tracking pixels
Archived newsletters and unknown correspondence often embed scripts or hidden 1x1 pixels pointing to external servers. Selecting any message filters markup through sanitizeEmailHtml before rendering the Formatted view, while Plain text exposes raw decoded text cleanly.
Stripping unsafe script tags and HTTP tracking pixels
To protect local inspection, sanitizeEmailHtml strips script, style, head, title, iframe, object, embed, applet, noscript, svg, math, template, and xml elements entirely. Every external HTTP and HTTPS <img> node is dropped so remote tracking URLs never trigger requests; images carrying alt attributes leave readable [Image: alt] placeholders.
Privacy audit check: Even when an archived message embeds live tracker image tags,
sanitizeEmailHtmlremoves every external URL before touching the DOM. Loadtakeout-sample.mboxvia Load sample MBOX to verify zero outbound image traffic inside DevTools.
Resolving local inline cid images without network calls
Corporate signatures and inline diagrams often live inside MIME multipart/related sections tied to Content-ID attributes. Following the RFC 2392 Content-ID URI scheme, matched cid: images resolve strictly from local message attachments.
The HTML sanitizer rewrites matched cid: artwork and allowed base64 data:image/ URLs (png, jpeg, jpg, gif, webp) into local data URIs while preserving safe target="_blank" and rel="noopener noreferrer" link attributes.
Exporting selected emails to PDF, EML ZIPs, and CSV indexes
After filtering rows with search terms or label pills, use Toggle all, individual row checkboxes, or preview buttons (Save and Save message attachments ZIP) to export selected records cleanly.
| Output action | Generated filename suffix | Payload format and schema | Primary downstream use |
|---|---|---|---|
| Export N selected as PDF | -selected.pdf |
Combined PDF, 10.5 pt sans, 48 pt margins | Printable discovery packets and archival reports |
| Export EMLs (.zip) | -eml.zip |
0001-<64-char-slug>.eml RFC 5322 files |
Re-importing mail into Thunderbird or Apple Mail |
| Extract attachments (.zip) | -attachments.zip |
Sanitized filenames prefixed by index | Collecting attached PDFs, invoices, and images |
| Download index CSV | -index.csv |
UTF-8 BOM CSV across 9 metadata columns | Spreadsheet sorting and discovery inventories |
| Save message attachments ZIP | message-<num>-attachments.zip |
Attachments scoped to active preview | Pulling attached files from one single message |
Bookmarked PDF layout and non-Latin font substitution
Running Export N selected as PDF writes an A4 or US Letter PDF with 10.5 pt sans body text, 48 pt margins, optional Add PDF bookmarks per message outlines, and List attachment names summaries. Characters outside standard WinAnsi Latin fonts are folded or replaced with ?, reporting exact replacement counts; compiled PDFs can pass straight to a bulk PDF text extraction pass.
EML ZIP numbering, attachment bundles, and CSV index columns
Choosing Export EMLs (.zip) runs unescapeMboxrdMessage per checked row and writes sequentially numbered files up to 64 sanitized slug characters. Selecting Download index CSV prepends a UTF-8 BOM (\uFEFF) across nine columns (#, Subject, From, To, Date, Labels, Has Attachments, Size (Bytes), Message-ID) for spreadsheet sorting.
When should you inspect exported headers from an MBOX mailbox?
Exporting a suspicious email through Export EMLs (.zip) or Save reveals complete unescaped RFC 5322 transport headers (Received, Authentication-Results, DKIM-Signature, and Return-Path). When diagnosing spoofed senders, phishing campaigns, or SMTP relay bottlenecks inside Takeout archives, load exported .eml headers directly into Email Header Analyzer for chronological hop timing, TLS verification, and DMARC alignment checks.
- Investigating delivery latency: Export target
.emlslices to audit chronological SMTP relay timestamps, encrypted TLS transport, and clock skew across mail servers. - Re-importing selective folders: Filter X-Gmail-Labels pills before calling Export EMLs (.zip) so migrated archives carry only chosen categories across mail clients.
- Preserving discovery trails: Pair
-selected.pdfpackets with-index.csvspreadsheets so legal reviewers retain uniqueMessage-IDidentifiers alongside exported timestamps and attachment flags. - Resetting large browser sessions: Click Change MBOX between exports to cancel active worker tasks and release indexed byte-offset tables from browser memory.