sourcepot/php-ole-msg-parser

Minimal PHP library for parsing Outlook .msg files incl. attachments stored in OLE compound documents.

Maintainers

Package info

github.com/SourcePot/php-ole-msg-parser

pkg:composer/sourcepot/php-ole-msg-parser

Statistics

Installs: 11

Dependents: 1

Suggesters: 0

Stars: 0

v1.2.0 2026-05-15 17:55 UTC

This package is auto-updated.

Last update: 2026-05-15 20:13:28 UTC


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