Merge pull request #851 from felixmosh/fix-850

fix: show utf-8 mail body properly
This commit is contained in:
cytopia 2022-01-26 12:08:04 +01:00 committed by GitHub
commit 5f465abd61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -4,8 +4,9 @@ class HtmlEmail extends HTMLElement {
this.attachShadow({ mode: 'open' });
let emailContent;
const templateId = this.dataset.templateId;
try {
emailContent = window.atob(this.dataset.content);
emailContent = document.getElementById(templateId).innerHTML;
} catch (error) {
console.log(error);
return;

View File

@ -186,8 +186,8 @@ $messages = $MyMbox->get($sortOrderArr);
<td></td>
<td colspan="4">
<?php if ($body !== null): ?>
<html-email data-content="<?php echo base64_encode($body) ?>">
</html-email>
<template id="mail-body-<?=$data['num']?>"><?=$body?></template>
<html-email data-template-id="mail-body-<?=$data['num']?>"></html-email>
<?php else: ?>
<div class="alert alert-warning" role="alert">
No valid body found
@ -213,12 +213,9 @@ $messages = $MyMbox->get($sortOrderArr);
<?php echo loadClass('Html')->getFooter(); ?>
<script>
$(function() {
$('.subject').each(function() {
$(this).click(function() {
var id = ($(this).attr('id'));
$('#mail-'+id).toggle();
})
$('.subject').click(function() {
var id = ($(this).attr('id'));
$('#mail-'+id).toggle();
})
// Handler for .ready() called.
});