A library that identifies quoted text in plain text and HTML email messages. quotequail has no mandatory dependencies, however using HTML methods require libxml.
(Interested in working on projects like this? Close is looking for great engineers to join our team)
Introduction
quotequail comes with the functions listed below which are documented in detail in quotequail’s __init__.py.
quote(text): Takes a plain text message as an argument, returns a list of tuples. The first argument of the tuple denotes whether the text should be expanded by default. The second argument is the unmodified corresponding text.
quote_html(html): Like quote(), but takes an HTML message as an argument.
unwrap(text): If the passed text is the text body of a forwarded message, a reply, or contains quoted text, a dictionary is returned, containing the type (reply/forward/quote), the text at the top/bottom of the wrapped message, any parsed headers, and the text of the wrapped message.
unwrap_html(text): Like unwrap(), but takes an HTML message as an argument.
Examples
In [1]: import quotequail
In [2]: quotequail.quote("""Hello world.
On 2012-10-16 at 17:02 , Someone <someone@example.com> wrote:
> Some quoted text
""")
Out[2]:
[(True, 'Hello world.\n\nOn 2012-10-16 at 17:02 , Someone <someone@example.com> wrote:'),
(False, '\n> Some quoted text\n')]
In [3]: quotequail.unwrap("""Hello
Begin forwarded message:
> From: "Some One" <some.one@example.com>
> Date: 1. August 2011 23:28:15 GMT-07:00
> To: "Other Person" <other@example.com>
> Subject: AW: AW: Some subject
>
> Original text
Text bottom
"""))
Out[3]:
{'date': '1. August 2011 23:28:15 GMT-07:00',
'from': '"Some One" <some.one@example.com>',
'subject': 'AW: AW: Some subject',
'text': 'Original text',
'text_bottom': 'Text bottom',
'text_top': 'Hello',
'to': '"Other Person" <other@example.com>',
'type': 'forward'}
Metadata
Release files for quotequail 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quotequail-0.5.3.tar.gz | 26.9 kB | Details |
Release files / quotequail-0.5.3.tar.gz
| Download URL | quotequail-0.5.3.tar.gz |
|---|---|
| Size | 26.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75e44ae04bb2c1b56a180bd5fe94e874cf82316a7903c34fcc69af68833a5695
|
|
BLAKE2b-256 checksum How to use checksums |
b1b41c252ed4c48afc282e90d9a2daf7de92001b208f58d0eadfba422f637c73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency log