PHP code example of fwiessner / php-bounce-mail-parser
1. Go to this page and download the library: Download fwiessner/php-bounce-mail-parser 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/ */
fwiessner / php-bounce-mail-parser example snippets
// Initialize compser autoloader
ser();
// You can specify a directory
$parser->parseDirectory('path/to/directory');
// or a single file (e.g. *.eml)
$parser->parseFile('path/to/file');
// or a single email loaded as string (e.g. via imap_open / imap_fetchbody)
$parser->parseData(explode("\n",$emailstring);
// Specify emails to be ignored when trying to find the recipient as follows
$parser->ignoreEmail('[email protected]');
// Finally get the data output directly in the browser with simple echo
$parser->outputCsv();
// return the Csv as string:
$parser->returnCsv();
// or as file download
$parser->saveCsvAs();
// Here is a complete working example
$parser = new \PhpBounceMailParser\Parser();
$parser->ignoreEmail('[email protected]')
->parseDirectory(__DIR__ . '/resources')
->outputCsv();