parse-emails


Nameparse-emails JSON
Version 0.1.45 PyPI version JSON
download
home_pageNone
SummaryParses an email message file and extracts the data from it.
upload_time2025-07-29 11:30:31
maintainerNone
docs_urlNone
authorDemisto
requires_python<3.13,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Coverage Status](https://coveralls.io/repos/github/demisto/email-parser/badge.svg?branch=master)](https://coveralls.io/github/demisto/email-parser?branch=master)
[![CLA assistant](https://cla-assistant.io/readme/badge/demisto/parse-emails)](https://cla-assistant.io/demisto/parse-emails)
[![CircleCI](https://circleci.com/gh/demisto/parse-emails/tree/master.svg?style=svg)](https://circleci.com/gh/demisto/parse-emails/tree/master)
# parse-emails
Parses an email message file and extracts the data from it.

The key features are:
* Supports `.eml` and `.msg` files.
* Extracts nested attachments.

## Requirements

Python 3.8.5+

## Installation

```console
$ pip install parse-emails
$ brew install libmagic
```

## Usage

The main class `EmailParser` contains all what you need to parse an email:

```python
import parse_emails

email = parse_emails.EmailParser(file_path=<file_path>, max_depth=3, parse_only_headers=False)
email.parse()
print(email.parsed_email['Subject'])
```

## Inputs

| **Argument Name** | **Description** |
| --- | --- |
| file_path* | the file_path of a in msg or eml format |
| parse_only_headers | Will parse only the headers and return headers table, Default is False|
| max_depth | How many levels deep we should parse the attached emails \(e.g. email contains an emails contains an email\). Default depth level is 3. Minimum level is 1, if set to 1 the script will parse only the first level email |
| file_info | the file info |

## Contributing
Contributions are welcome and appreciated. To contribute you can submit a PR.

Before merging any PRs, we need all contributors to sign a contributor license agreement. By signing a contributor license agreement, we ensure that the community is free to use your contributions.

When you open a new pull request, a bot will evaluate whether you have signed the CLA. If required, the bot will comment on the pull request, including a link to accept the agreement. The CLA document is also available for review as a [PDF](https://github.com/demisto/content/blob/master/docs/cla.pdf).

If the `license/cla` status check remains on *Pending*, even though all contributors have accepted the CLA, you can recheck the CLA status by visiting the following link (replace **[PRID]** with the ID of your PR): https://cla-assistant.io/check/demisto/email-parser?pullRequest=[PRID] .

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "parse-emails",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Demisto",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/23/fb/ced4d1f8fe99fc0b06510bb80de973945ef555665881e621818814c7963d/parse_emails-0.1.45.tar.gz",
    "platform": null,
    "description": "[![Coverage Status](https://coveralls.io/repos/github/demisto/email-parser/badge.svg?branch=master)](https://coveralls.io/github/demisto/email-parser?branch=master)\n[![CLA assistant](https://cla-assistant.io/readme/badge/demisto/parse-emails)](https://cla-assistant.io/demisto/parse-emails)\n[![CircleCI](https://circleci.com/gh/demisto/parse-emails/tree/master.svg?style=svg)](https://circleci.com/gh/demisto/parse-emails/tree/master)\n# parse-emails\nParses an email message file and extracts the data from it.\n\nThe key features are:\n* Supports `.eml` and `.msg` files.\n* Extracts nested attachments.\n\n## Requirements\n\nPython 3.8.5+\n\n## Installation\n\n```console\n$ pip install parse-emails\n$ brew install libmagic\n```\n\n## Usage\n\nThe main class `EmailParser` contains all what you need to parse an email:\n\n```python\nimport parse_emails\n\nemail = parse_emails.EmailParser(file_path=<file_path>, max_depth=3, parse_only_headers=False)\nemail.parse()\nprint(email.parsed_email['Subject'])\n```\n\n## Inputs\n\n| **Argument Name** | **Description** |\n| --- | --- |\n| file_path* | the file_path of a in msg or eml format |\n| parse_only_headers | Will parse only the headers and return headers table, Default is False|\n| max_depth | How many levels deep we should parse the attached emails \\(e.g. email contains an emails contains an email\\). Default depth level is 3. Minimum level is 1, if set to 1 the script will parse only the first level email |\n| file_info | the file info |\n\n## Contributing\nContributions are welcome and appreciated. To contribute you can submit a PR.\n\nBefore merging any PRs, we need all contributors to sign a contributor license agreement. By signing a contributor license agreement, we ensure that the community is free to use your contributions.\n\nWhen you open a new pull request, a bot will evaluate whether you have signed the CLA. If required, the bot will comment on the pull request, including a link to accept the agreement. The CLA document is also available for review as a [PDF](https://github.com/demisto/content/blob/master/docs/cla.pdf).\n\nIf the `license/cla` status check remains on *Pending*, even though all contributors have accepted the CLA, you can recheck the CLA status by visiting the following link (replace **[PRID]** with the ID of your PR): https://cla-assistant.io/check/demisto/email-parser?pullRequest=[PRID] .\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Parses an email message file and extracts the data from it.",
    "version": "0.1.45",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0b95b5cf0b83a08a60736e059c7da628e65541b1fa8e6f226b25993d72418a2f",
                "md5": "76626caeb0dee64ce2dd04e403667703",
                "sha256": "5d223e97271e650f8976077273ac66bd06b89aad9108bdef0f455a08c385a41f"
            },
            "downloads": -1,
            "filename": "parse_emails-0.1.45-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "76626caeb0dee64ce2dd04e403667703",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 8913516,
            "upload_time": "2025-07-29T11:30:28",
            "upload_time_iso_8601": "2025-07-29T11:30:28.832169Z",
            "url": "https://files.pythonhosted.org/packages/0b/95/b5cf0b83a08a60736e059c7da628e65541b1fa8e6f226b25993d72418a2f/parse_emails-0.1.45-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23fbced4d1f8fe99fc0b06510bb80de973945ef555665881e621818814c7963d",
                "md5": "ddab214e9ecb4f50a71ed707c013df84",
                "sha256": "4f104f37426b753068af72255e9ca43c3f82649afb793d833c725da9c4ec25e9"
            },
            "downloads": -1,
            "filename": "parse_emails-0.1.45.tar.gz",
            "has_sig": false,
            "md5_digest": "ddab214e9ecb4f50a71ed707c013df84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 8865361,
            "upload_time": "2025-07-29T11:30:31",
            "upload_time_iso_8601": "2025-07-29T11:30:31.397294Z",
            "url": "https://files.pythonhosted.org/packages/23/fb/ced4d1f8fe99fc0b06510bb80de973945ef555665881e621818814c7963d/parse_emails-0.1.45.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-29 11:30:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "parse-emails"
}
        
Elapsed time: 0.70636s