Registry / communication / email-reply-parser

email-reply-parser

JSON →
library0.5.12pypypi✓ verified 23d ago

Email Reply Parser is a Python library that simplifies the process of extracting the most recent reply from plain text email conversations. It is a port of GitHub's original Ruby email_reply_parser. The library helps in automatically stripping out quoted previous messages, signatures, and disclaimers, providing a cleaner, actionable response. The current version, 0.5.12, was released in October 2020, indicating a slow release cadence.

pip install email-reply-parser
INSTALL
IMPORT
SIG · EMAIL-REPLY-PARSER
E
email-reply-parser
communicationpythonv0.5.12
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EmailReplyParser
from email_reply_parser import EmailReplyParser

This example demonstrates how to use `EmailReplyParser.read()` to get a detailed breakdown of email fragments and `EmailReplyParser.parse_reply()` to extract only the most recent, non-quoted, non-signature reply from an email body.

from email_reply_parser import EmailReplyParser email_body = '''Hi there, I appreciate your help with this issue. Best regards, John On Mon, Apr 8, 2026 at 10:00 AM, Support <support@example.com> wrote: > How can we help you today? > > Thanks, > Support Team''' # Get the full parsed email structure (list of fragments) parsed_email = EmailReplyParser.read(email_body) print("--- Full Parsed Email Fragments ---") for fragment in parsed_email.fragments: print(f"Content: {fragment.content.strip()}\nIs a signature: {fragment.is_signature}\nIs quoted: {fragment.is_quoted}\nIs hidden: {fragment.is_hidden}\n---") # Get only the reply message (stripping quotes and signatures) reply_text = EmailReplyParser.parse_reply(email_body) print("\n--- Extracted Reply Text ---") print(reply_text)
Debug
Known issues
gotchaThe parser primarily relies on English-specific heuristics (e.g., 'On <date>, <author> wrote:') for identifying quoted replies. It may not work correctly or be less effective with emails in other languages or with different reply header formats.
fix
For multi-language support, consider using a more actively maintained library or a service designed for international email parsing.
affects: <=0.5.12
gotchaThis library is strictly designed for plain text emails. It does not process HTML email content, and feeding it HTML input may lead to incorrect or incomplete parsing results.
fix
Ensure that the email content is converted to plain text before passing it to the parser. If HTML parsing is required, a different library capable of handling HTML email structures is needed.
affects: <=0.5.12
gotchaSignature detection is heuristic-based (e.g., looking for lines starting with `--` or `__`). Its accuracy can vary significantly depending on the email client, custom signature formats, and general email content.
fix
Review parsed output for emails with unusual signature formats and consider custom pre-processing or post-processing if precise signature stripping is critical.
affects: <=0.5.12
gotchaQuoted headers (like 'On <date>, <author> wrote:') that span multiple lines due to email client formatting (e.g., Gmail's line-wrapping) may not be correctly identified and stripped, leading to quoted content appearing in the reply.
fix
No direct fix within the library; manual pre-processing to normalize such headers might be necessary, but this can be complex.
affects: <=0.5.12
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'email_reply_parser'
The 'email-reply-parser' Python package is not installed in the current environment or there is a typo in the import statement.
fix
Install the package using `pip install email-reply-parser` and ensure the import statement is `from email_reply_parser import EmailReplyParser`.
AttributeError: module 'email_reply_parser' has no attribute 'read'
The `read` and `parse_reply` methods are part of the `EmailReplyParser` class, not directly on the `email_reply_parser` module itself. This error occurs when attempting to call `email_reply_parser.read()` or `email_reply_parser.parse_reply()` after only `import email_reply_parser`.
fix
Import the `EmailReplyParser` class directly using `from email_reply_parser import EmailReplyParser` and then call its methods: `EmailReplyParser.read(email_content)` or `EmailReplyParser.parse_reply(email_content)`.
email-reply-parser not stripping signature
The library's heuristic rules for identifying and stripping signatures, quoted text, or reply headers may not perfectly match the diverse formatting of all email clients, complex email threads, or non-English languages.
fix
There is no single code fix as this often indicates a limitation in the parsing logic for specific email formats. Users may need to manually inspect the `EmailReplyParser.read(email_content).fragments` to understand how the email was parsed, consider pre-processing the email content, or accept that certain complex email structures may not be perfectly handled.
AttributeError: 'NoneType' object has no attribute 'split'
The 'EmailReplyParser.read()' method received 'None' as input, or an object without a 'split' method, when it expects a string.
fix
Ensure that the input passed to 'EmailReplyParser.read()' is a string and handle cases where the input might be 'None' or another unexpected type.
Upgrade
Version history
0.5.12latest on PyPI · released Oct 7, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
email-reply-parser — pip install email-reply-parser · libregistry