1. Go to this page and download the library: Download ackneal/multipart library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ackneal / multipart example snippets
$message = <<<EOT
This is the preamble. It is to be ignored, though it
is a handy place for mail composers to It does NOT end with a linebreak.
--simple boundary
Content-type: text/plain; charset=us-ascii
This is explicitly typed plain ASCII text.
It DOES end with a linebreak.
--simple boundary--
This is the epilogue. It is also to be ignored.
EOT;
$stream = new \Multipart\Stream($message, 'simple boundary');
while ($part = $stream->readPart()) {
echo $part->getHeaderLine('content-type') . PHP_EOL;
echo $part->getBody() . PHP_EOL;
}
/**
*
* This is implicitly typed plain ASCII text.
* It does NOT end with a linebreak.
* text/plain; charset=us-ascii
* This is explicitly typed plain ASCII text.
* It DOES end with a linebreak.
*/