python-oxmsg


Namepython-oxmsg JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryExtract attachments from Outlook .msg files.
upload_time2024-06-01 20:53:37
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords ms-oxmsg outlook email
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![MIT License](https://img.shields.io/badge/License-MIT-orange.svg)](LICENSE.txt)
[![on PyPI](https://img.shields.io/badge/pypi-0.0.1-blue.svg)](https://pypi.org/project/python-oxmsg/0.0.1/)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-brightgreen.svg)](https://www.python.org/downloads/)

# python-oxmsg

Parse Outlook MSG (.msg) files to extract email messages and attachments.

The target use case is extracting Outlook message text and accessing attachments. There is no support for modifying messages or creating them from scratch. In addition to message text, other message properties such as sent-date, etc. are also accessible.


## Documentation

Documentation for this project is on [GitHub Pages](https://scanny.github.io/python-oxmsg).


## Installation
```bash
pip install python-oxmsg
```
Occasionally it can be useful to install from a GitHub branch, perhaps to try out a version that has not yet been released. This command would install from the `develop` branch:
```bash
pip install git+https://github.com/scanny/python-oxmsg@develop
```

## Usage
```python
>>> from oxmsg import Message
>>> msg = Message.load("message.msg")
>>> msg.message_class
'IPM.Note'
>>> msg.attachment_count
1
>>> attachment = msg.attachments[0]
>>> attachment.attached_by_value  # -- attachment bytes only available when True --
True
>>> attachment.filename
'q1-objectives.pptx'
>>> attachment.mime_type
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
>>> attachment.size
96407
>>> attachment.last_modified.isoformat()
'2023-11-18T16:08:17+00:00'
>>> with open(attachment.filename, "wb") as f:
...     f.write(attachment.file_bytes)
```

## CLI

`python-oxmsg` includes a CLI that may be useful for diagnostic purposes.
```bash
$ oxmsg
Usage: oxmsg [OPTIONS] COMMAND [ARGS]...

  Utility CLI for `python-oxmsg`.

  Provides the subcommands listed below, useful for exploratory or diagnostic
  purposes.

Options:
  --help  Show this message and exit.

Commands:
  dump     Write a summary of the MSG file's properties to stdout.
  storage  Summarize low-level "directories and files" structure of MSG...

```

The `dump` sub-command displays all properties available in the message along with the
PID and PTYP information required to access those properties from a `Properties` object.

```bash
$ oxmsg dump message.msg

------------------
Message Properties
------------------

header-properties
-----------------
recipient_count:    1

distinguished-properties
------------------------
attachment_count:         0
internet_code_page:       utf-8
message_class:            IPM.Note
sender:                   from@domain.com
...

other properties
-----------------------------------------+---------------+--------------------
property-id                              | type          | value
-----------------------------------------+---------------+--------------------
0x0017 - PidTagImportance                | PtypInteger32 | 00 00 00 01
0x001A - PidTagMessageClass              | PtypString8   | 'IPM.Note'
0x0036 - PidTagSensitivity               | PtypInteger32 | 00 00 00 00
0x0037 - PidTagSubject                   | PtypString8   | 'A test message'
0x003B - PidTagSentRepresentingSearchKey | PtypBinary    | 21 bytes
0x003D - PidTagSubjectPrefix             | PtypString8   | ''
0x0042 - PidTagSentRepresentingName      | PtypString8   | 'from@domain.com'
...
```

## Changelog

The release history including a chronicle of notable changes with each release is
recorded in [CHANGELOG.md](https://github.com/scanny/python-oxmsg/blob/master/CHANGELOG.md).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-oxmsg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "ms-oxmsg, outlook, email",
    "author": null,
    "author_email": "Steve Canny <stcanny@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/4f/d4/4ec721fd433453fe05344f41f17458775d111e9f6c668ce1a0fccec0fecd/python_oxmsg-0.0.1.tar.gz",
    "platform": null,
    "description": "[![MIT License](https://img.shields.io/badge/License-MIT-orange.svg)](LICENSE.txt)\n[![on PyPI](https://img.shields.io/badge/pypi-0.0.1-blue.svg)](https://pypi.org/project/python-oxmsg/0.0.1/)\n[![Python 3.9+](https://img.shields.io/badge/python-3.9+-brightgreen.svg)](https://www.python.org/downloads/)\n\n# python-oxmsg\n\nParse Outlook MSG (.msg) files to extract email messages and attachments.\n\nThe target use case is extracting Outlook message text and accessing attachments. There is no support for modifying messages or creating them from scratch. In addition to message text, other message properties such as sent-date, etc. are also accessible.\n\n\n## Documentation\n\nDocumentation for this project is on [GitHub Pages](https://scanny.github.io/python-oxmsg).\n\n\n## Installation\n```bash\npip install python-oxmsg\n```\nOccasionally it can be useful to install from a GitHub branch, perhaps to try out a version that has not yet been released. This command would install from the `develop` branch:\n```bash\npip install git+https://github.com/scanny/python-oxmsg@develop\n```\n\n## Usage\n```python\n>>> from oxmsg import Message\n>>> msg = Message.load(\"message.msg\")\n>>> msg.message_class\n'IPM.Note'\n>>> msg.attachment_count\n1\n>>> attachment = msg.attachments[0]\n>>> attachment.attached_by_value  # -- attachment bytes only available when True --\nTrue\n>>> attachment.filename\n'q1-objectives.pptx'\n>>> attachment.mime_type\n'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n>>> attachment.size\n96407\n>>> attachment.last_modified.isoformat()\n'2023-11-18T16:08:17+00:00'\n>>> with open(attachment.filename, \"wb\") as f:\n...     f.write(attachment.file_bytes)\n```\n\n## CLI\n\n`python-oxmsg` includes a CLI that may be useful for diagnostic purposes.\n```bash\n$ oxmsg\nUsage: oxmsg [OPTIONS] COMMAND [ARGS]...\n\n  Utility CLI for `python-oxmsg`.\n\n  Provides the subcommands listed below, useful for exploratory or diagnostic\n  purposes.\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  dump     Write a summary of the MSG file's properties to stdout.\n  storage  Summarize low-level \"directories and files\" structure of MSG...\n\n```\n\nThe `dump` sub-command displays all properties available in the message along with the\nPID and PTYP information required to access those properties from a `Properties` object.\n\n```bash\n$ oxmsg dump message.msg\n\n------------------\nMessage Properties\n------------------\n\nheader-properties\n-----------------\nrecipient_count:    1\n\ndistinguished-properties\n------------------------\nattachment_count:         0\ninternet_code_page:       utf-8\nmessage_class:            IPM.Note\nsender:                   from@domain.com\n...\n\nother properties\n-----------------------------------------+---------------+--------------------\nproperty-id                              | type          | value\n-----------------------------------------+---------------+--------------------\n0x0017 - PidTagImportance                | PtypInteger32 | 00 00 00 01\n0x001A - PidTagMessageClass              | PtypString8   | 'IPM.Note'\n0x0036 - PidTagSensitivity               | PtypInteger32 | 00 00 00 00\n0x0037 - PidTagSubject                   | PtypString8   | 'A test message'\n0x003B - PidTagSentRepresentingSearchKey | PtypBinary    | 21 bytes\n0x003D - PidTagSubjectPrefix             | PtypString8   | ''\n0x0042 - PidTagSentRepresentingName      | PtypString8   | 'from@domain.com'\n...\n```\n\n## Changelog\n\nThe release history including a chronicle of notable changes with each release is\nrecorded in [CHANGELOG.md](https://github.com/scanny/python-oxmsg/blob/master/CHANGELOG.md).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Extract attachments from Outlook .msg files.",
    "version": "0.0.1",
    "project_urls": {
        "Changelog": "https://github.com/scanny/python-oxmsg/blob/master/CHANGELOG.md",
        "Documentation": "https://scanny.github.io/python-oxmsg/",
        "Homepage": "https://github.com/scanny/python-oxmsg",
        "Repository": "https://github.com/scanny/python-oxmsg"
    },
    "split_keywords": [
        "ms-oxmsg",
        " outlook",
        " email"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4c8fb23e1e7723ba9200b75bc121f22f67498ae098a202f1646acc4f6a54f5c",
                "md5": "d425c88a20c742a2e196c9dfcf925a9b",
                "sha256": "8ea7d5dda1bc161a413213da9e18ed152927c1fda2feaf5d1f02192d8ad45eea"
            },
            "downloads": -1,
            "filename": "python_oxmsg-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d425c88a20c742a2e196c9dfcf925a9b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 31426,
            "upload_time": "2024-06-01T20:53:35",
            "upload_time_iso_8601": "2024-06-01T20:53:35.895058Z",
            "url": "https://files.pythonhosted.org/packages/d4/c8/fb23e1e7723ba9200b75bc121f22f67498ae098a202f1646acc4f6a54f5c/python_oxmsg-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fd44ec721fd433453fe05344f41f17458775d111e9f6c668ce1a0fccec0fecd",
                "md5": "89cb43237cb032b636906af08cbdbd1b",
                "sha256": "b65c1f93d688b85a9410afa824192a1ddc39da359b04a0bd2cbd3874e84d4994"
            },
            "downloads": -1,
            "filename": "python_oxmsg-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "89cb43237cb032b636906af08cbdbd1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 34541,
            "upload_time": "2024-06-01T20:53:37",
            "upload_time_iso_8601": "2024-06-01T20:53:37.558296Z",
            "url": "https://files.pythonhosted.org/packages/4f/d4/4ec721fd433453fe05344f41f17458775d111e9f6c668ce1a0fccec0fecd/python_oxmsg-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-01 20:53:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scanny",
    "github_project": "python-oxmsg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "python-oxmsg"
}
        
Elapsed time: 0.33948s