A powerful Python tool to convert .eml email files into formatted PDF documents. Features batch processing, HTML email rendering with embedded images, attachment extraction, and a modern GUI with drag-and-drop support.
- Batch Conversion - Convert multiple
.emlfiles in a single operation - HTML Email Rendering - Properly renders HTML emails with formatting (using WeasyPrint)
- Embedded Images - Extracts and embeds inline CID images in PDFs
- Attachment Extraction - Optionally saves email attachments alongside PDFs
- CLI & GUI - Use from command line for automation or via graphical interface
- Drag-and-Drop - Drop folders directly onto the GUI to convert
- Organized Output - PDFs automatically organized by year/month
- Progress Tracking - Visual progress with ETA and cancel support
- Settings Panel - Customize page size, fonts, metadata fields
- Skipped Files Report - Detailed PDF report for any failed conversions
- Cross-Platform - Works on macOS, Windows, and Linux
# Clone the repository
git clone https://github.com/nassereledroos/EML-to-PDF.git
cd EML-to-PDF
# Install dependencies
pip install -r requirements.txt
# Run the application
python eml_to_pdf.pyFor the full feature set, install all optional dependencies:
pip install weasyprint ttkbootstrap tkinterdnd2- weasyprint - Better HTML email rendering with CSS support
- ttkbootstrap - Modern themed GUI
- tkinterdnd2 - Drag-and-drop support
Simply run without arguments to launch the graphical interface:
python eml_to_pdf.py
# or
python -m eml_to_pdf# Convert emails from a folder
python -m eml_to_pdf -i ~/emails
# Specify output folder
python -m eml_to_pdf -i ~/emails -o ~/pdfs
# Extract attachments
python -m eml_to_pdf -i ~/emails --extract-attachments
# Flat output (no year/month folders)
python -m eml_to_pdf -i ~/emails --no-organize
# Show help
python -m eml_to_pdf --help| Option | Description |
|---|---|
-i, --input FOLDER |
Input folder containing EML files |
-o, --output FOLDER |
Output folder for PDFs (default: INPUT/PDF) |
--page-size {letter,a4} |
PDF page size (default: letter) |
--extract-attachments |
Extract and save email attachments |
--no-organize |
Don't organize by year/month folders |
--no-weasyprint |
Disable WeasyPrint (use simple text rendering) |
-v, --verbose |
Verbose output |
-q, --quiet |
Suppress output except errors |
--gui |
Force GUI mode |
Build standalone applications that don't require Python:
# Install build dependencies
pip install -r requirements-dev.txt
# Build for current platform
python build.py
# Build and package for release
python build.py --package
# Clean build artifacts
python build.py --clean# macOS
./scripts/build_macos.sh
# Windows
scripts\build_windows.bat
# Linux
./scripts/build_linux.shPush a version tag to trigger GitHub Actions builds for all platforms:
git tag v2.0.0
git push origin v2.0.0EML-to-PDF/
βββ eml_to_pdf.py # Entry point (wrapper script)
βββ eml_to_pdf/ # Main package
β βββ __init__.py
β βββ __main__.py # Module entry point
β βββ cli.py # Command-line interface
β βββ gui.py # Graphical interface
β βββ converter.py # Core conversion logic
β βββ html_renderer.py # HTML to PDF rendering
β βββ attachment_handler.py
β βββ config.py # Settings management
β βββ utils.py # Shared utilities
βββ build.py # Build script
βββ requirements.txt # Runtime dependencies
βββ requirements-dev.txt # Build dependencies
βββ pyproject.toml # Project metadata
βββ assets/ # Application icons
βββ scripts/ # Platform build scripts
βββ .github/workflows/ # CI/CD workflows
Settings are stored in ~/.eml_to_pdf_config.json and can be configured via the GUI Settings panel:
- Page Size - Letter or A4
- Font - Helvetica, Times-Roman, or Courier
- Output Structure - Organize by year/month or flat
- Metadata Fields - Choose which fields to include
- Attachments - Enable/disable extraction
- HTML Rendering - Use WeasyPrint or simple text
Downloaded executables are not signed with an Apple Developer ID. On first launch:
- Right-click (or Control-click) the app
- Select Open from the context menu
- Click Open in the security dialog
- Future launches will work normally
- Python 3.8+
- reportlab (required)
- weasyprint (optional, for HTML rendering)
- ttkbootstrap (optional, for modern UI)
- tkinterdnd2 (optional, for drag-and-drop)
This project is released under the CC0 Public Domain Dedication. See the LICENSE file for details.
Created by Nasser Eledroos
Contributions and feedback are welcome!