[Web] Add html2text converter; Show quarantaine html elements as text, do not escape html

This commit is contained in:
andre.peters
2018-01-18 10:09:30 +01:00
parent 9ba0786fbf
commit 79cb929911
78 changed files with 28586 additions and 1247 deletions

View File

@@ -33,12 +33,17 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
$data = array();
// Init parser
$mail_parser = new PhpMimeMailParser\Parser();
$html2text = new Html2Text\Html2Text();
// Load msg to parser
$mail_parser->setText($mailc['msg']);
// Get text/plain content
$data['text_plain'] = $mail_parser->getMessageBody('text');
// Get html content and convert to text
$data['text_html'] = $html2text->convert($mail_parser->getMessageBody('html'));
(empty($data['text_plain'])) ? $data['text_plain'] = '-' : null;
// Get subject
$data['subject'] = $mail_parser->getHeader('subject');
(empty($data['subject'])) ? $data['subject'] = '-' : null;
// Get attachments
if (is_dir($tmpdir)) {
rrmdir($tmpdir);