fwiessner / php-bounce-mail-parser
用于分析退信邮件的库
v1.0
2020-11-19 19:39 UTC
Requires
- php: >=5.4.0
- ext-mailparse: *
- php-mime-mail-parser/php-mime-mail-parser: >=2.1
This package is auto-updated.
Last update: 2024-09-20 04:02:52 UTC
README
如何使用Composer安装 Composer
要安装此库,请运行以下命令并获取最新版本
composer require fwiessner/php-bounce-mail-parser
如何使用它
<?php // Initialize compser autoloader require_once __DIR__ . '/vendor/autoload.php'; $parser = new \PhpBounceMailParser\Parser(); // 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('no-reply@wf-ingbau.de'); // 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('foo@bar.com') ->parseDirectory(__DIR__ . '/resources') ->outputCsv(); ?>