mail-parser-reply


Namemail-parser-reply JSON
Version 1.25 PyPI version JSON
download
home_pagehttps://github.com/alfonsrv/mail-parser-reply
Summary📧 Email reply parser library for Python with multi-language support
upload_time2023-11-19 00:39:13
maintainerAlfons R.
docs_urlNone
authorAlfons R.
requires_python
licenseMIT
keywords mail email parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mail Reply Parser 📧🐍 

[![Python](https://img.shields.io/badge/Made%20with-Python%203.x-blue.svg?style=flat-square&logo=Python&logoColor=white)](https://www.python.org/) 
[![Version](https://img.shields.io/badge/Version-1.2-dc2f02.svg?style=flat-square&logoColor=white)](https://github.com/alfonsrv/mail-parser-reply)


### Multi-language email reply parsing for international environments 🌍

Mail clients handle reply formatting differently, making reliable parsing difficult. Thank god we have 
[standards](https://xkcd.com/927/).  This library splits *text-based* emails into separate replies based on common 
headers produced by different, multilingual clients usually indicating separation.

Replies can either present the whole mail message body, or strip headers, signatures and common disclaimers if required. 
Currently supported languages are: English (`en`), German (`de`), French (`fr`), Italian (`it`) and Japanese (`ja`) – 
adding more languages is quite easy.

This is an improved Python implementation of GitHub's Ruby-based [email_reply_parser](https://github.com/github/email_reply_parser/) 
and an adaptation of Zapier's [email-reply-parser](https://github.com/zapier/email-reply-parser) which both split the 
mails in fragments instead of distinct replies. They also only support English.


## ⭐ Features

⭐ Easy to implement  
⭐ Multilanguage Support  
⭐ Text-based mail parsing  
⭐ Detect headers, signatures and disclaimers  
⭐ Fully type annotated  
⭐ Easy-to-read code and well-tested  


## Overview 🔭

This library makes it easy to split an incoming mail into replies, making working with emails much more manageable
and easily providing the text content for each reply – with or without signatures, disclaimers and headers.

For example, it can turn the following email:

```
Awesome! I haven't had another problem with it.

Thanks,
alfonsrv

On Wed, Dec 20, 2023 at 13:37, RAUSYS <info@rausys.de> wrote:

> The good news is that I've found a much better query for lastLocation.
> It should run much faster now. Can you double-check?
```

Into just the replied text content:

```
Awesome! I haven't had another problem with it.
```


## Get started 👾

### Installation

```bash
pip install mail-parser-reply
```

### Parse Replies

```python
from mailparser_reply import EmailReplyParser

mail_body = 'foobar'; languages = ['en', 'de']
mail_message = EmailReplyParser(languages=languages).read(text=mail_body)
print(mail_message.replies)
```

*Or* get only the latest reply using:

```python
latest_reply = EmailReplyParser(languages=languages).parse_reply(text=mail_body)
```

### Parser API

```
EmailMessage.text:              Mail body
EmailMessage.languages:         Languages to use for parsing headers
EmailMessage.replies:           List of EmailReply; single parsed replies
EmailMessage.include_english:   Always include English language for parsing
EmailMessage.default_language:  Default language to use if language dictionary 
                                doesn't include

EmailMessage.HEADER_REGEX:      RegEx for identifying headers, separating mails
EmailMessage.SIGNATURE_REGEX:   RegEx for identifying signatures
EmailMessage.DISCLAIMERS_REGEX: RegEx for identifying disclaimers

EmailMessage.read(): Parse EmailMessage.text to EmailReply which are then stored 
                     in EmailMessage.replies
```

```
EmailReply.content:     Unprocessed mail body with headers, signatures, disclaimers
EmailReply.body:        Mail body without headers, signatures, disclaimers
EmailReply.full_body:   Mail body; just without headers

EmailReply.headers:     Identified Headers
EmailReply.signatures:  Identified Signatures
EmailReply.disclaimers: Identified disclaimers
```



---

[![Buy me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/alfonsrv)  

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alfonsrv/mail-parser-reply",
    "name": "mail-parser-reply",
    "maintainer": "Alfons R.",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "alfonsrv@pm.me",
    "keywords": "mail,email,parser",
    "author": "Alfons R.",
    "author_email": "alfonsrv@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/90/db/5e12d93ba4c75f92ea0efe004b6b226de2698244cca2ceb3d6da9f3c5fad/mail-parser-reply-1.25.tar.gz",
    "platform": null,
    "description": "# Mail Reply Parser \ud83d\udce7\ud83d\udc0d \n\n[![Python](https://img.shields.io/badge/Made%20with-Python%203.x-blue.svg?style=flat-square&logo=Python&logoColor=white)](https://www.python.org/) \n[![Version](https://img.shields.io/badge/Version-1.2-dc2f02.svg?style=flat-square&logoColor=white)](https://github.com/alfonsrv/mail-parser-reply)\n\n\n### Multi-language email reply parsing for international environments \ud83c\udf0d\n\nMail clients handle reply formatting differently, making reliable parsing difficult. Thank god we have \n[standards](https://xkcd.com/927/).  This library splits *text-based* emails into separate replies based on common \nheaders produced by different, multilingual clients usually indicating separation.\n\nReplies can either present the whole mail message body, or strip headers, signatures and common disclaimers if required. \nCurrently supported languages are: English (`en`), German (`de`), French (`fr`), Italian (`it`) and Japanese (`ja`) \u2013 \nadding more languages is quite easy.\n\nThis is an improved Python implementation of GitHub's Ruby-based [email_reply_parser](https://github.com/github/email_reply_parser/) \nand an adaptation of Zapier's [email-reply-parser](https://github.com/zapier/email-reply-parser) which both split the \nmails in fragments instead of distinct replies. They also only support English.\n\n\n## \u2b50 Features\n\n\u2b50 Easy to implement  \n\u2b50 Multilanguage Support  \n\u2b50 Text-based mail parsing  \n\u2b50 Detect headers, signatures and disclaimers  \n\u2b50 Fully type annotated  \n\u2b50 Easy-to-read code and well-tested  \n\n\n## Overview \ud83d\udd2d\n\nThis library makes it easy to split an incoming mail into replies, making working with emails much more manageable\nand easily providing the text content for each reply \u2013 with or without signatures, disclaimers and headers.\n\nFor example, it can turn the following email:\n\n```\nAwesome! I haven't had another problem with it.\n\nThanks,\nalfonsrv\n\nOn Wed, Dec 20, 2023 at 13:37, RAUSYS <info@rausys.de> wrote:\n\n> The good news is that I've found a much better query for lastLocation.\n> It should run much faster now. Can you double-check?\n```\n\nInto just the replied text content:\n\n```\nAwesome! I haven't had another problem with it.\n```\n\n\n## Get started \ud83d\udc7e\n\n### Installation\n\n```bash\npip install mail-parser-reply\n```\n\n### Parse Replies\n\n```python\nfrom mailparser_reply import EmailReplyParser\n\nmail_body = 'foobar'; languages = ['en', 'de']\nmail_message = EmailReplyParser(languages=languages).read(text=mail_body)\nprint(mail_message.replies)\n```\n\n*Or* get only the latest reply using:\n\n```python\nlatest_reply = EmailReplyParser(languages=languages).parse_reply(text=mail_body)\n```\n\n### Parser API\n\n```\nEmailMessage.text:              Mail body\nEmailMessage.languages:         Languages to use for parsing headers\nEmailMessage.replies:           List of EmailReply; single parsed replies\nEmailMessage.include_english:   Always include English language for parsing\nEmailMessage.default_language:  Default language to use if language dictionary \n                                doesn't include\n\nEmailMessage.HEADER_REGEX:      RegEx for identifying headers, separating mails\nEmailMessage.SIGNATURE_REGEX:   RegEx for identifying signatures\nEmailMessage.DISCLAIMERS_REGEX: RegEx for identifying disclaimers\n\nEmailMessage.read(): Parse EmailMessage.text to EmailReply which are then stored \n                     in EmailMessage.replies\n```\n\n```\nEmailReply.content:     Unprocessed mail body with headers, signatures, disclaimers\nEmailReply.body:        Mail body without headers, signatures, disclaimers\nEmailReply.full_body:   Mail body; just without headers\n\nEmailReply.headers:     Identified Headers\nEmailReply.signatures:  Identified Signatures\nEmailReply.disclaimers: Identified disclaimers\n```\n\n\n\n---\n\n[![Buy me a Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/alfonsrv)  \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\udce7 Email reply parser library for Python with multi-language support",
    "version": "1.25",
    "project_urls": {
        "Homepage": "https://github.com/alfonsrv/mail-parser-reply"
    },
    "split_keywords": [
        "mail",
        "email",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "76095781ab63a73007718285eb41cee0717824e008ff08f375a85df9aabaf8a2",
                "md5": "024cf19dc9875957936e35e391219de6",
                "sha256": "b6a7e0881bfb4dafc5e5d0ff31b0414eef38698975cd99cbd06a30834bc63576"
            },
            "downloads": -1,
            "filename": "mail_parser_reply-1.25-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "024cf19dc9875957936e35e391219de6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10219,
            "upload_time": "2023-11-19T00:39:11",
            "upload_time_iso_8601": "2023-11-19T00:39:11.289251Z",
            "url": "https://files.pythonhosted.org/packages/76/09/5781ab63a73007718285eb41cee0717824e008ff08f375a85df9aabaf8a2/mail_parser_reply-1.25-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90db5e12d93ba4c75f92ea0efe004b6b226de2698244cca2ceb3d6da9f3c5fad",
                "md5": "b145261c534afacca83075bbee9a9857",
                "sha256": "a223352b4acbfc305275f1b4938734a3be3806540b730dfbb78480a530a8890e"
            },
            "downloads": -1,
            "filename": "mail-parser-reply-1.25.tar.gz",
            "has_sig": false,
            "md5_digest": "b145261c534afacca83075bbee9a9857",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11041,
            "upload_time": "2023-11-19T00:39:13",
            "upload_time_iso_8601": "2023-11-19T00:39:13.286004Z",
            "url": "https://files.pythonhosted.org/packages/90/db/5e12d93ba4c75f92ea0efe004b6b226de2698244cca2ceb3d6da9f3c5fad/mail-parser-reply-1.25.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-19 00:39:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alfonsrv",
    "github_project": "mail-parser-reply",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mail-parser-reply"
}
        
Elapsed time: 0.22860s