sourcepot / php-ole-msg-parser
Minimal PHP library for parsing Outlook .msg files incl. attachments stored in OLE compound documents.
v1.2.0
2026-05-15 17:55 UTC
Requires
- php: ^8.0
README
Minimal PHP library for parsing Outlook .msg files stored in OLE compound documents. This packaged is derived from koopa/php-ole-msg-parser.
Features
- Reads raw OLE compound streams without external dependencies
- Extracts headers, plain-text body, RTF body (as attachment) and attachments from .msg files
- Provides lightweight loader interfaces for custom property handling
- Test web page included: .../php-ole-msg-parser/src/www/index.php
Installation
composer require sourcepot/php-ole-msg-parser
Usage
require __DIR__ . '/vendor/autoload.php'; $parser = new \Opt\OLE\MsgParser('path/to/message.msg'); $message = $parser->parse(); $headers = $message->headers; $transportLayerRawHeaders=$headers['TRANSPORT_MESSAGE_HEADERS']; $body = $message->body; foreach ($message->attachments as $attachment){ file_put_contents($attachment['filename'], $attachment['data']); }
Requirements
- PHP 8.0+
- mbstring extenstion
License
MIT