Skip to Content
textrawl
CLI Tools

MBOX Conversion

Convert MBOX email archives to searchable markdown

Convert MBOX email archives from Gmail, Thunderbird, or other email clients to searchable markdown files.

Usage

pnpm convert -- mbox <file> [options]

Options

OptionDefaultDescription
-o, --output <dir>./converted/emailsOutput directory
-v, --verbosefalseEnable verbose logging
--dry-runfalsePreview without writing
-t, --tags <tags...>["email"]Additional tags
--skip-attachmentsfalseSkip attachment extraction

Example

# Convert Gmail export
pnpm convert -- mbox ~/Downloads/All\ mail.mbox -o ./emails

# With custom tags
pnpm convert -- mbox archive.mbox -t work important

# Dry run to preview
pnpm convert -- mbox archive.mbox --dry-run

Output Format

Each email becomes a markdown file:

---
title: "Re: Project Update"
source_type: email
source_hash: "abc123..."
tags:
  - email
  - imported
created_at: "2024-01-15T10:30:00Z"
converted_at: "2024-03-20T14:22:00Z"
metadata:
  from: "alice@example.com"
  to: "bob@example.com"
  cc: "team@example.com"
  subject: "Re: Project Update"
  message_id: "<unique-id@mail.example.com>"
  in_reply_to: "<parent-id@mail.example.com>"
---

# Re: Project Update

Email body content here...

Supported Sources

  • Gmail: Google Takeout MBOX exports
  • Thunderbird: Profile folder backups
  • Apple Mail: Exported mailboxes
  • Outlook: Exported MBOX files

Next Steps

On this page