Skip to content

Add EML export implementation guide and GetManyRFC2822Task#106

Closed
bengotow wants to merge 1 commit intomasterfrom
claude/review-forum-issues-KT1mG
Closed

Add EML export implementation guide and GetManyRFC2822Task#106
bengotow wants to merge 1 commit intomasterfrom
claude/review-forum-issues-KT1mG

Conversation

@bengotow
Copy link
Copy Markdown
Collaborator

@bengotow bengotow commented Apr 9, 2026

Summary

This PR adds comprehensive documentation for EML export functionality and implements the GetManyRFC2822Task in mailsync to enable bulk folder export. It includes a detailed implementation guide for the client-side features that will be built in the Mailspring repo.

Key Changes

  • New documentation (EML_EXPORT_IMPLEMENTATION.md): Complete architecture guide covering:

    • Background and community request history
    • Overview of two task types (GetMessageRFC2822Task and GetManyRFC2822Task)
    • Four client-side features (single download, drag-and-drop, forward as attachment, folder export)
    • Detailed mailsync task specifications with JSON schemas
    • Client implementation guide with code examples
    • Testing checklist and validation procedures
  • New mailsync task (GetManyRFC2822Task):

    • Exports all messages in a folder to a directory as .eml files
    • Processes messages in chunks of 50 with progress tracking
    • Supports resume on restart by tracking exported count
    • Handles per-message errors gracefully without aborting the export
    • Supports cancellation via should_cancel flag
    • Generates sanitized filenames with format: {index} - {subject} - {date}.eml
  • Filename sanitization helper (sanitizeEmlFilename):

    • Replaces filesystem-illegal characters with underscores
    • Truncates subjects to 80 characters
    • Strips trailing dots and spaces (Windows requirement)
    • Zero-pads index to 5 digits for natural sort order
    • Clamps total filename length to 200 chars on Windows for MAX_PATH compliance
  • Task routing: Added GetManyRFC2822Task handling in performLocal and performRemote methods

Implementation Details

  • Progress is saved to task.data["progress"] after each chunk of 50 messages, enabling real-time progress bar updates in the client
  • Final results written to task.data["result"] with summary statistics and error list
  • Chunk processing includes 1-second sleep between chunks to prevent blocking other sync operations
  • Resume logic reads task.data.progress.exported to determine starting index on restart
  • Error handling logs per-message failures but continues processing remaining messages
  • Supports both POSIX and Windows path handling with appropriate string conversions

https://claude.ai/code/session_013AQPfia7V9Mxf4NL9peegn

Implements a new bulk export task that fetches RFC2822 data for all
messages in a folder and writes them as .eml files to a directory.
Processes messages in chunks of 50 with 1s pauses between batches,
reports progress via task data deltas, supports cancellation via
should_cancel, and resumes from last exported index on restart.

Also adds a shared filename sanitizer (sanitizeEmlFilename) that
produces collision-free filenames with index prefix and date suffix,
with Windows MAX_PATH clamping.

Includes detailed implementation guide for the client-side features:
single email download, drag-and-drop, forward-as-attachment, and
folder export UI.

https://claude.ai/code/session_013AQPfia7V9Mxf4NL9peegn
@bengotow bengotow closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants