bedezign / yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.
https://bedezign.github.io/yii2-audit/
Other
193 stars 112 forks source link

Add support for another Mail parse #250

Closed tarranjones closed 5 years ago

tarranjones commented 6 years ago

modify bedezign\yii2-audit\src\views\mail\view-html.php to support a mail parser which does not rely on the "php-mailparse" php extension.

if (class_exists('\PhpMimeMailParser\Parser')) {
    $parser = new \PhpMimeMailParser\Parser();
    $parser->setText($model->data);
    echo $parser->getMessageBody('htmlEmbedded');
} else if (class_exists('\ZBateson\MailMimeParser\MailMimeParser')) {
    $parser = new \ZBateson\MailMimeParser\MailMimeParser();
    $message = $parser->parse($model->data);
    echo $message->getHtmlContent();
} else {
    echo Html::tag('pre', $model->data) . Html::tag('br') . 'Please install php-mime-mail-parser for better functionality';
// or zbateson/mail-mime-parser
}
Blizzke commented 5 years ago

I'll look into providing functionality to somehow register a callback to do your own custom rendering. We can't be expected to provide support for any email renderer out there. I hope you understand that.

Blizzke commented 5 years ago

1.1.2 allows you to add a panel function called "renderEmail". If you do that, the control of outputting the mail will be passed on to your function. Haven't been able to properly test this, but hopefully this works. The documentation was updated to reflect this change. Closing this for now, feel free to open this again if there are issues.