Parse EML file and export the information extracted as JSON.
Project description
Overview
EMLMailReader is a comprehensive Python library designed to parse and extract information from EML (Email Message Format) files. The library provides a robust solution for reading email files, extracting headers, body content, attachments, and handling complex MIME structures with support for various encoding formats.
Key Features
- Complete EML Parsing: Parse standard EML files with full MIME support
- Multi-part Message Support: Handle complex email structures with nested MIME parts
- Attachment Extraction: Extract and save file attachments with proper metadata
- Encoding Support: Decode Base64, Quoted-Printable, and other transfer encodings
- Address Parsing: Parse and manage email addresses with display names
- Logging Integration: Comprehensive logging for debugging and monitoring
- Exception Handling: Custom exceptions for specific error scenarios
Quick Start
Installation
pip install emlmailreader
Basic Usage
from EMLMailReader import MailReader, LoggingMode
# Initialize the mail reader
reader = MailReader(logging_mode=LoggingMode.CONSOLE)
# Parse an EML file
message = reader.get_email("/path/to/email.eml")
if message:
# Access basic email information
print(f"From: {message.From}")
print(f"Subject: {message.Subject}")
print(f"Date: {message.Date}")
# Access recipients
print(f"To: {message.To}")
print(f"Cc: {message.Cc}")
# Access body content
print(f"Body: {message.Body}")
# Check for attachments
if message.Attachments.length() > 0:
print(f"Found {message.Attachments.length()} attachments")
# Save attachments to a folder
message.save_attachments("/path/to/output/folder")
# Export message as JSON
json_data = message.export_as_json()
print(json_data)
License
This library is distributed under the terms specified in the LICENSE file.
Support
For issues, questions, or contributions, please refer to the project repository.
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
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 emlmailreader-1.0.4.tar.gz.
File metadata
- Download URL: emlmailreader-1.0.4.tar.gz
- Upload date:
- Size: 33.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd4c62f2eb081aa4fd1a6bb9be8ca16cf6d3e8cf1292619dcb84561ff598b282
|
|
| MD5 |
25668c1b8e05b1ec98d2e250832c041e
|
|
| BLAKE2b-256 |
cc76d0c5035df915f74fffcc285ebcde704f6cbf74525057cb9f9d79058ff1f3
|
Provenance
The following attestation bundles were made for emlmailreader-1.0.4.tar.gz:
Publisher:
release.yml on codadel/EMLMailReader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlmailreader-1.0.4.tar.gz -
Subject digest:
cd4c62f2eb081aa4fd1a6bb9be8ca16cf6d3e8cf1292619dcb84561ff598b282 - Sigstore transparency entry: 2136083281
- Sigstore integration time:
-
Permalink:
codadel/EMLMailReader@316e83975cfc3416ccd0045e435a96f27f0c4030 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/codadel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@316e83975cfc3416ccd0045e435a96f27f0c4030 -
Trigger Event:
push
-
Statement type:
File details
Details for the file emlmailreader-1.0.4-py3-none-any.whl.
File metadata
- Download URL: emlmailreader-1.0.4-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cefd175ba39f689dea2fef183846ce0c0776ba1449387163c789e290cc56f9a9
|
|
| MD5 |
2e515d9a817b816d0520190caf2956a0
|
|
| BLAKE2b-256 |
6d87ec05fb668cc8984af3735b9061082220c6460508e95de2ea4745036d5d3b
|
Provenance
The following attestation bundles were made for emlmailreader-1.0.4-py3-none-any.whl:
Publisher:
release.yml on codadel/EMLMailReader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlmailreader-1.0.4-py3-none-any.whl -
Subject digest:
cefd175ba39f689dea2fef183846ce0c0776ba1449387163c789e290cc56f9a9 - Sigstore transparency entry: 2136083438
- Sigstore integration time:
-
Permalink:
codadel/EMLMailReader@316e83975cfc3416ccd0045e435a96f27f0c4030 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/codadel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@316e83975cfc3416ccd0045e435a96f27f0c4030 -
Trigger Event:
push
-
Statement type: