Parses a MIME message into a \ZBateson\MailMimeParser\Message object.

To invoke, call parse on a MailMimeParser object.

$handle = fopen('path/to/file.txt'); $parser = new MailMimeParser(); $parser->parse($handle); fclose($handle);

author Zaahid Bateson
package MailMimeParser


Sets up the parser.

__construct(\ZBateson\MailMimeParser\Container $di = null




pass a Container object to use it for initialization.

Parses the passed stream handle into a ZBateson\MailMimeParser\Message object and returns it.

parse(resource|string $handleOrString) : \ZBateson\MailMimeParser\Message

Internally, the message is first copied to a temp stream (with php://temp which may keep it in memory or write it to disk) and its stream is used. That way if the message is too large to hold in memory it can be written to a temporary file if need be.




the resource handle to the input stream of the mime message, or a string containing a mime message





dependency injection container

$di : \ZBateson\MailMimeParser\Container




<p>defines the default charset used by MessagePart.</p>

DEFAULT_CHARSET = 'UTF-8' : string