mail page rest

This commit is contained in:
alma 2025-04-21 14:06:21 +02:00
parent 38a507d51e
commit de9ffd6f0a

View File

@ -488,30 +488,22 @@ function renderEmailContent(email: Email) {
let isHtml = false;
if (parsed.html) {
content = parsed.html;
// Use our existing MIME decoding for HTML content
content = decodeMIME(parsed.html, 'quoted-printable', 'utf-8');
isHtml = true;
} else if (parsed.text) {
content = parsed.text;
// Use our existing MIME decoding for plain text content
content = decodeMIME(parsed.text, 'quoted-printable', 'utf-8');
isHtml = false;
} else {
// Try to extract content directly from body
// Try to extract content directly from body using our existing functions
const htmlMatch = email.body.match(/<html[^>]*>[\s\S]*?<\/html>/i);
if (htmlMatch) {
content = htmlMatch[0];
content = decodeMIME(htmlMatch[0], 'quoted-printable', 'utf-8');
isHtml = true;
} else {
content = email.body
.replace(/<[^>]+>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/\r\n/g, '\n')
.replace(/=\n/g, '')
.replace(/=3D/g, '=')
.replace(/=09/g, '\t')
.trim();
// Use our existing text extraction function
content = extractTextFromHtml(email.body);
isHtml = false;
}
}