diff --git a/components/email/EmailPreview.tsx b/components/email/EmailPreview.tsx index ea3f57f5..789e8c96 100644 --- a/components/email/EmailPreview.tsx +++ b/components/email/EmailPreview.tsx @@ -123,14 +123,17 @@ export default function EmailPreview({ email, loading = false, onReply }: EmailP hasAttachments: email.hasAttachments || false }; - // Get the raw content - this is what we'd normally display directly + // Get the raw content directly const rawContent = email.content || email.html || email.text || ''; - // Log both raw and formatted content for debugging - console.log("Raw content:", rawContent.substring(0, 200)); + // Now use the same content that would be shown in a reply + // This is exactly what ComposeEmail shows + const { content } = formatReplyEmail(formatterEmail, 'reply'); - // Use the same formatters that ComposeEmail uses - setFormattedContent(rawContent); + console.log("Formatted content for display:", content.substring(0, 200)); + + // Use the formatted content that includes the proper structure + setFormattedContent(content); } catch (error) { console.error('Error formatting email content:', error); // Fallback to raw content if formatting fails