messaged/php-mime-mail-parser

此包已被废弃,不再维护。作者建议使用php-mime-mail-parser/php-mime-mail-parser包。

PHP 5.3+版本的Mailparse扩展包装器

v1.0.7 2015-01-04 16:11 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:22:11 UTC


README

此仓库已废弃。已迁移至 https://github.com/php-mime-mail-parser/php-mime-mail-parser

PHP 5.3+ 的 http://code.google.com/p/php-mime-mail-parser 分支

贡献

欢迎贡献。

Composer

"require": {
	"messaged/php-mime-mail-parser": "v1.0.7"
}

使用示例

use MimeMailParser\Parser;
use MimeMailParser\Attachment;

$parser = new Parser();
$parser->setText(file_get_contents('/path/to/mail'));

$to = $parser->getHeader('to');
$delivered_to = $parser->getHeader('delivered-to');
$from = $parser->getHeader('from');
$subject = $parser->getHeader('subject');
$text = $parser->getMessageBody('text');
$html = $parser->getMessageBody('html');
$attachments = $parser->getAttachments();

// Write attachments to disk
foreach ($attachments as $attachment) {
    $attachment->saveAttachment('/tmp');
}