mail page rest
This commit is contained in:
parent
38a507d51e
commit
de9ffd6f0a
@ -488,30 +488,22 @@ function renderEmailContent(email: Email) {
|
|||||||
let isHtml = false;
|
let isHtml = false;
|
||||||
|
|
||||||
if (parsed.html) {
|
if (parsed.html) {
|
||||||
content = parsed.html;
|
// Use our existing MIME decoding for HTML content
|
||||||
|
content = decodeMIME(parsed.html, 'quoted-printable', 'utf-8');
|
||||||
isHtml = true;
|
isHtml = true;
|
||||||
} else if (parsed.text) {
|
} 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;
|
isHtml = false;
|
||||||
} else {
|
} 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);
|
const htmlMatch = email.body.match(/<html[^>]*>[\s\S]*?<\/html>/i);
|
||||||
if (htmlMatch) {
|
if (htmlMatch) {
|
||||||
content = htmlMatch[0];
|
content = decodeMIME(htmlMatch[0], 'quoted-printable', 'utf-8');
|
||||||
isHtml = true;
|
isHtml = true;
|
||||||
} else {
|
} else {
|
||||||
content = email.body
|
// Use our existing text extraction function
|
||||||
.replace(/<[^>]+>/g, '')
|
content = extractTextFromHtml(email.body);
|
||||||
.replace(/ /g, ' ')
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/\r\n/g, '\n')
|
|
||||||
.replace(/=\n/g, '')
|
|
||||||
.replace(/=3D/g, '=')
|
|
||||||
.replace(/=09/g, '\t')
|
|
||||||
.trim();
|
|
||||||
isHtml = false;
|
isHtml = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user