Convert .eml email files to clean Markdown
Project description
eml-to-md
Convert .eml email files to clean, readable Markdown.
Supports Python 3.9–3.14+ — unlike alternatives that are stuck on older versions.
Features
- HTML emails → Markdown (headings, bold, links, lists)
- Plain text emails preserved as-is
- Multipart emails handled (prefers HTML part)
- Attachment listing with file sizes
- Pipe-friendly: read from stdin, write to stdout
- Usable as a CLI tool or Python library
Installation
pip install eml-to-md
Or with pipx for isolated CLI usage:
pipx install eml-to-md
CLI Usage
# Convert a single file (writes message.md alongside it)
eml2md message.eml
# Batch convert into a folder
eml2md *.eml -o converted/
# Print to terminal
eml2md message.eml --stdout
# Pipe from stdin
cat message.eml | eml2md -
# Check version
eml2md --version
Python API
import eml_to_md
# From a file path
markdown = eml_to_md.convert("message.eml")
print(markdown)
# From a file object
with open("message.eml", "rb") as f:
markdown = eml_to_md.convert(f)
# Convert and write to disk
out_path = eml_to_md.convert_file("message.eml")
# -> writes message.md, returns Path
# Custom output path
eml_to_md.convert_file("message.eml", output="output/email.md")
Output Format
# Subject Line
- **From:** sender@example.com
- **To:** recipient@example.com
- **Date:** Mon, 10 Mar 2026 10:00:00 +0000
---
Email body converted to Markdown...
---
## Attachments
- `document.pdf` (142.3 KB)
- `photo.jpg` (1.2 MB)
Development
git clone https://github.com/glnarayanan/eml-to-md.git
cd eml-to-md
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
# Run tests
pytest
# Lint
ruff check src/ tests/
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eml_to_md-0.1.0.tar.gz
(9.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eml_to_md-0.1.0.tar.gz.
File metadata
- Download URL: eml_to_md-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b87d49f2c8163b2a4755e84a640f07679fd0be9e9bbc8f5b69c16e5c661e5153
|
|
| MD5 |
decea64f50a59e6a7de55309b2801837
|
|
| BLAKE2b-256 |
e8fed4e71ce47147194d43df7644c99a4fe9f016c83957f0d4a5fa30756d82ce
|
File details
Details for the file eml_to_md-0.1.0-py3-none-any.whl.
File metadata
- Download URL: eml_to_md-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330746572caedb5116be3914ec9b28299a0880ad6c61c372c45d6f4e3383c01f
|
|
| MD5 |
e38b28e319d70950f20adf2c0a62b21a
|
|
| BLAKE2b-256 |
8ac5431b209049047243b2d35c9f45d9ebdbcffea36a9b312880d2799499ca4b
|