Skip to main content

Recursively extract attachments from .mbox files

Project description

mbox-extractor

mbox-extractor

License Python

📬 Recursively extract all attachments from .mbox email archives with a single command test123

Features

  • Recursive scanning - Finds all .mbox files in any directory tree
  • Safe filenames - Sanitizes attachment names, removing illegal characters
  • No duplicates - Uses content-based hashing to prevent overwrites
  • Progress display - Visual progress bar for large mailboxes

Quick Start

uv tool install mbox-extractor
mbox-extractor /path/to/emails

Installation

Using uv (recommended)

uv tool install mbox-extractor

Using pip

pip install mbox-extractor

From source

git clone https://github.com/tsilva/mbox-extractor.git
cd mbox-extractor
uv tool install .

Usage

Extract all attachments from .mbox files under a directory:

mbox-extractor /path/to/search

Attachments from each .mbox file are saved to a folder with the same name:

Found mbox: /emails/archive.mbox -> extracting to /emails/archive
Extracting archive.mbox: 100%|████████████████████| 500/500 [00:10<00:00, 48.5it/s]
Extracted 42 attachments to '/emails/archive'.

How It Works

  1. Recursively scans the given path for .mbox files
  2. Opens each mailbox and iterates through all messages
  3. Extracts attachments with sanitized, unique filenames
  4. Saves them to a folder named after the source .mbox file

Filenames are made unique by appending an 8-character MD5 hash of the file content, preventing overwrites when multiple attachments share the same name.

Requirements

  • Python 3.7+
  • tqdm (installed automatically)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mbox_extractor-0.1.6.tar.gz (168.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mbox_extractor-0.1.6-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file mbox_extractor-0.1.6.tar.gz.

File metadata

  • Download URL: mbox_extractor-0.1.6.tar.gz
  • Upload date:
  • Size: 168.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mbox_extractor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6ff4dc8122aa834981c3f4bee11c778f3cae6692c737fe895e55aa7c1effe187
MD5 32696230cadf7ac8279e9a0bbb8f21b8
BLAKE2b-256 912557f23dc9b9311191e5cace4fbdfc6a451bfcd32875c2f96a2f340b571c22

See more details on using hashes here.

Provenance

The following attestation bundles were made for mbox_extractor-0.1.6.tar.gz:

Publisher: release.yml on tsilva/mbox-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mbox_extractor-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: mbox_extractor-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mbox_extractor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 646f0067872d1c147e8f1d8ecccd377e3b80ace19ffc945b5d40f3b123eb737c
MD5 5b7b4da31f5b385911ddb5036ae6c6b5
BLAKE2b-256 86fdd866a2947fc2e5d5f80b47c8df125c1d9ae364de80de7e2a573dab9c62af

See more details on using hashes here.

Provenance

The following attestation bundles were made for mbox_extractor-0.1.6-py3-none-any.whl:

Publisher: release.yml on tsilva/mbox-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page