MailMimeParser
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);
Tags
Table of Contents
- DEFAULT_CHARSET = 'UTF-8'
- $di : Container
- __construct() : mixed
- Sets up the parser.
- parse() : Message
- Parses the passed stream handle into a ZBateson\MailMimeParser\Message object and returns it.
Constants
DEFAULT_CHARSET
public
string
DEFAULT_CHARSET
= 'UTF-8'
Properties
$di
protected
Container
$di
Methods
__construct()
Sets up the parser.
public
__construct([Container $di = null ]) : mixed
Parameters
- $di : Container = null
-
pass a Container object to use it for initialization.
Return values
mixed —parse()
Parses the passed stream handle into a ZBateson\MailMimeParser\Message object and returns it.
public
parse(resource|string $handleOrString) : 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.
Parameters
- $handleOrString : resource|string
-
the resource handle to the input stream of the mime message, or a string containing a mime message