diff --git a/.devilbox/www/htdocs/assets/js/html-email.js b/.devilbox/www/htdocs/assets/js/html-email.js deleted file mode 100644 index 5e4725ce..00000000 --- a/.devilbox/www/htdocs/assets/js/html-email.js +++ /dev/null @@ -1,22 +0,0 @@ -class HtmlEmail extends HTMLElement { - constructor() { - super(); - this.attachShadow({ mode: 'open' }); - - let emailContent; - const templateId = this.dataset.templateId; - try { - emailContent = document.getElementById(templateId).innerHTML; - } catch (error) { - console.log(error); - return; - } - - const container = document.createElement('div'); - container.innerHTML = emailContent; - - this.shadowRoot.appendChild(container); - } -} - -customElements.define('html-email', HtmlEmail); diff --git a/.devilbox/www/htdocs/mail.php b/.devilbox/www/htdocs/mail.php index 5de1dc6d..21dc6990 100644 --- a/.devilbox/www/htdocs/mail.php +++ b/.devilbox/www/htdocs/mail.php @@ -24,6 +24,28 @@ require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDeco require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php'; require $LIB_DIR . DIRECTORY_SEPARATOR . 'Sort.php'; +if (isset($_GET['get-body']) && is_numeric($_GET['get-body'])) { + $messageNumber = $_GET['get-body']; + $MyMbox = new \devilbox\Mail('/var/mail/devilbox'); + $message = $MyMbox->getMessage($messageNumber-1); + $structure = $message['decoded']; + + $body = null; + if (isset($structure->body)) { + $body = $structure->body; + } + elseif(isset($structure->parts[1]->body)) { + $body = $structure->parts[1]->body; + } + elseif(isset($structure->parts[0]->body)) { + $body = $structure->parts[0]->body; + } + + exit(json_encode(array( + 'raw' => htmlentities($message['raw']), + 'body' => $body, + ))); +} if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { $message = $_GET['delete']; @@ -171,17 +193,6 @@ $messages = $MyMbox->get($sortOrderArr); body)) { - $body = $structure->body; - } - elseif(isset($structure->parts[1]->body)) { - $body = $structure->parts[1]->body; - } - elseif(isset($structure->parts[0]->body)) { - $body = $structure->parts[0]->body; - } ?>