diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx
index b1647b2e..d7341a89 100644
--- a/app/courrier/page.tsx
+++ b/app/courrier/page.tsx
@@ -370,20 +370,11 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward' = 'r
decodedContent = convertCharset(partBody, partHeaderInfo.charset);
}
- // Preserve the original MIME structure
if (partHeaderInfo.contentType.includes('text/html')) {
- content = `
-
- ${decodedContent}
-
- `;
+ content = decodedContent;
break;
} else if (partHeaderInfo.contentType.includes('text/plain') && !content) {
- content = `
-
- `;
+ content = decodedContent;
}
} catch (error) {
console.error('Error decoding email part:', error);
@@ -392,54 +383,43 @@ function getReplyBody(email: Email, type: 'reply' | 'reply-all' | 'forward' = 'r
} else {
// Handle simple email
try {
- let decodedBody = '';
if (headerInfo.encoding === 'base64') {
- decodedBody = decodeBase64(body, headerInfo.charset);
+ content = decodeBase64(body, headerInfo.charset);
} else if (headerInfo.encoding === 'quoted-printable') {
- decodedBody = decodeQuotedPrintable(body, headerInfo.charset);
+ content = decodeQuotedPrintable(body, headerInfo.charset);
} else {
- decodedBody = convertCharset(body, headerInfo.charset);
+ content = convertCharset(body, headerInfo.charset);
}
-
- content = `
-
- ${headerInfo.contentType.includes('text/html') ? decodedBody : `
${decodedBody}`}
-
- `;
} catch (error) {
console.error('Error decoding email body:', error);
content = body;
}
}
- // Clean and sanitize HTML content while preserving structure
+ // Clean and sanitize HTML content
content = cleanHtml(content);
- // Format the reply/forward content with proper structure and direction
+ // Format the reply/forward content
let formattedContent = '';
if (type === 'forward') {
formattedContent = `
-
-