Skip to content

a library that identifies quoted text in email messages

License

Notifications You must be signed in to change notification settings

dixahq/quotequail

This branch is 12 commits ahead of, 48 commits behind closeio/quotequail:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7a35327 · Jul 26, 2024

History

89 Commits
Jul 4, 2023
Jul 26, 2024
Jul 4, 2023
Jul 4, 2023
Jan 11, 2023
Jul 4, 2023
Feb 6, 2015
Mar 30, 2016
Jul 4, 2023
Jul 4, 2023
Jul 4, 2023
Jul 4, 2023

Repository files navigation

quotequail

https://circleci.com/gh/closeio/quotequail/tree/master.svg?style=svg&circle-token=493e282bf7e3bf5e72bf3e255a116534ed8a79ab

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.io 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 <[email protected]> wrote:

> Some quoted text
""")
Out[2]:
[(True, 'Hello world.\n\nOn 2012-10-16 at 17:02 , Someone <[email protected]> wrote:'),
 (False, '\n> Some quoted text\n')]

In [3]: quotequail.unwrap("""Hello

Begin forwarded message:

> From: "Some One" <[email protected]>
> Date: 1. August 2011 23:28:15 GMT-07:00
> To: "Other Person" <[email protected]>
> Subject: AW: AW: Some subject
>
> Original text

Text bottom
"""))
Out[3]:
{'date': '1. August 2011 23:28:15 GMT-07:00',
 'from': '"Some One" <[email protected]>',
 'subject': 'AW: AW: Some subject',
 'text': 'Original text',
 'text_bottom': 'Text bottom',
 'text_top': 'Hello',
 'to': '"Other Person" <[email protected]>',
 'type': 'forward'}

About

a library that identifies quoted text in email messages

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 90.0%
  • HTML 10.0%