panel 2 courier api restore

This commit is contained in:
alma 2025-04-26 10:56:09 +02:00
parent 684c0cf4ef
commit d0136a32a5
2 changed files with 28 additions and 11 deletions

View File

@ -198,11 +198,13 @@ export default function ComposeEmail({
// First try the html field which should contain the raw HTML
if (initialEmail.html && initialEmail.html.trim()) {
console.log('Using HTML content for forward');
// Preserve the HTML exactly as-is without any wrapper divs that could break styles
originalContent = initialEmail.html;
}
// Then try the content field
else if (initialEmail.content && initialEmail.content.trim()) {
console.log('Using content field for forward');
// Preserve the content exactly as-is
originalContent = initialEmail.content;
}
// Fall back to text with styling if available
@ -219,9 +221,11 @@ export default function ComposeEmail({
// Preserve all original structure by wrapping, not modifying the original content
const forwardedContent = `
${headerHtml}
<!-- Start original email content - DO NOT MODIFY THIS CONTENT -->
<div class="original-email-content" style="margin-top: 10px; border-left: 2px solid #e1e1e1; padding-left: 15px;">
${originalContent}
</div>
<!-- End original email content -->
`;
console.log('Setting body with forwarded content');

View File

@ -665,17 +665,30 @@ export function formatEmailForReplyOrForward(
.map(addr => `${addr.name} <${addr.address}>`)
.join(', ');
} else if (type === 'forward') {
formattedContent = `
<div class="forwarded-message">
<p>---------- Forwarded message ---------</p>
<p>From: ${decoded.from || ''}</p>
<p>Date: ${formatDate(decoded.date ? new Date(decoded.date) : null)}</p>
<p>Subject: ${decoded.subject || ''}</p>
<p>To: ${decoded.to || ''}</p>
<br>
${decoded.html || `<pre>${decoded.text || ''}</pre>`}
</div>
`;
// Forward case doesn't need to set recipients
to = '';
// Instead, we format the content differently
const formattedDate = email.date ? new Date(email.date).toLocaleString() : '';
const fromText = email.from.map(f => f.name ? `${f.name} <${f.address}>` : f.address).join(', ');
const toText = email.to.map(t => t.name ? `${t.name} <${t.address}>` : t.address).join(', ');
// Return specialized body for forward
return {
to: '',
subject,
body: `
<div class="forwarded-message">
<p>---------- Forwarded message ---------</p>
<p>From: ${fromText}</p>
<p>Date: ${formattedDate}</p>
<p>Subject: ${email.subject || ''}</p>
<p>To: ${toText}</p>
<br>
${email.html || email.text ? (email.html || `<pre>${email.text || ''}</pre>`) : '<p>No content available</p>'}
</div>
`
};
}
// Format the email body with quote