Skip to main content

Python library for OE Classic email client data operations

Project description

PyOEClassic

A Python library for working with OE Classic email client data (MBX files and SQLite databases).

Installation

pip install -e .

Quick Start

from pyoeclassic import Client

# Connect to an identity
client = Client(identity="Testing")

# List folders
for folder in client.folders.list():
    print(f"{folder.name}: {folder.total_count} emails")

# Access emails
inbox = client.emails("Inbox")
print(f"Total: {inbox.count()}, Unread: {inbox.unread_count()}")

# Search emails
results = inbox.search(subject="*report*", limit=10)

# Get full email content
email = inbox.get(1)
print(email.body_text)

# Export emails
inbox.export("backup.jsonl", format="jsonl")

OEC Browser

A simple command-line tool for browsing OE Classic email data:

# Interactive mode (menu-driven)
python oec_browser.py

# List folders and email counts
python oec_browser.py --list

# Show all files in identity folder
python oec_browser.py --all-files

# List detached folders (files not in database)
python oec_browser.py --detached

# Browse a specific folder
python oec_browser.py --folder Inbox

# Browse a detached folder directly
python oec_browser.py --detached-folder "Archive"

# Search by subject or sender
python oec_browser.py --search-subject "report" --search-folder Inbox
python oec_browser.py --search-sender "john@example.com"

# Analytics
python oec_browser.py --stats              # Folder statistics
python oec_browser.py --top-senders Inbox  # Top senders in folder
python oec_browser.py --top-senders-all    # Top senders across all folders

Interactive Menu Features

  • Browse: Folder tree, detached folders, all files
  • Search: By subject, sender, or content (single folder or all)
  • Analytics: Folder stats, top senders, top domains

CLI

# List identities
pyoeclassic identities

# Show identity info
pyoeclassic info -i Testing

# List folders
pyoeclassic folders list --tree

# Folder operations
pyoeclassic folders attach "MyFolder"
pyoeclassic folders detach 5
pyoeclassic folders status

# Email operations
pyoeclassic emails list -f Inbox
pyoeclassic emails search "*report*" -f Inbox
pyoeclassic emails export backup.jsonl -f Inbox

MCP Service (Internal Install)

The OE Classic search/write MCP server is packaged as optional PyOEClassic features for the local Windows automation setup:

pip install -e ".[all]"
pyoeclassic-mcp --host 127.0.0.1 --port 8093
pyoeclassic-build-index --update

The Windows service wrapper can be installed/refreshed through a local deployment script that runs the packaged service module under a Python environment with pywin32. The service is intentionally local-only (127.0.0.1:8093) and bound to Main Identity.

External Gmail/Hotmail sending is handled by queueing messages into OE Classic so OE can use its existing account authentication. The packaged MCP does not ship the abandoned direct Gmail API send path.

OE Classic Corruption Recovery

Operational recovery notes are included for agents and operators:

  • Human runbook: docs/runbooks/oeclassic-corrupt-mbx-recovery.md
  • Packaged LLM card: pyoeclassic/llm/oeclassic-corruption-recovery.md

The short version: stop OE Classic and PythonOEClassicEmailMCP, back up the .mbx/.db pair, repair copied files first, and deploy only after structural verification passes.

Folder Attach/Detach

Archive old folders by detaching them:

from pathlib import Path
from pyoeclassic import Client

client = Client(identity="Testing")

# Detach folder and move files to archive
client.folders.detach_to_archive(
    folder_id=5,
    archive_path=Path("/backups/email_archive")
)

# Re-attach later
client.folders.attach_from_archive(
    name="OldEmails",
    archive_path=Path("/backups/email_archive")
)

Safety

The library protects "Main Identity" from write operations. Test identities (Testing, Testing2, Testing3) are safe for development.

Project Structure

pyoeclassic/           # Main library
  client.py            # Client class
  core/                # Config, database, MBX parser
  operations/          # Folder and email managers
  models/              # Folder and Email models
  cli/                 # Command-line interface

oec_browser.py         # Simple browser tool
examples/              # Example scripts
tests/                 # Test suite
_legacy/               # Old scripts (archived)

MBX File Format

OE Classic MBX files use a specific format:

  • [hdr] - Message header marker
  • mlen=<hex> - Message length in hexadecimal
  • [msg] - Message content follows

Running Tests

pytest

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

pyoeclassic-0.2.3.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

pyoeclassic-0.2.3-py3-none-any.whl (52.7 kB view details)

Uploaded Python 3

File details

Details for the file pyoeclassic-0.2.3.tar.gz.

File metadata

  • Download URL: pyoeclassic-0.2.3.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyoeclassic-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6a048f1014cf44dfa5b305d014e11f4ec2e4f29efbe7ffa767a30d24abcc119c
MD5 f21663dac3eabd28d198e8bdb345e1ee
BLAKE2b-256 f01a16a169b7d01991008b997eec39c5718d9d9661837a1ad25f8961a798b43e

See more details on using hashes here.

File details

Details for the file pyoeclassic-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pyoeclassic-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 52.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyoeclassic-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 898f477fc6c2a92c1a120d5071c0f563e06db763ac4783299203b98478ac36f1
MD5 fb7aff4e78e8f4193d0f5a896b673195
BLAKE2b-256 098a5952dc38f78fff201716c8f5e994112718d20602ff650ef47faaa0a1238f

See more details on using hashes here.

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