bedezign/yii2-audit

Add support for another Mail parse

tarranjones opened this issue · 2 comments

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
}

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.

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.