diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index c01cdb05..f23f32bf 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -1678,6 +1678,14 @@ export default function CourrierPage() { // Set state for compose form setIsReplying(true); setIsForwarding(type === 'forward'); + + // Set original email content for LegacyAdapter + setOriginalEmail({ + content: formattedContent, + type: type + }); + + // Show compose form with formatted content setShowCompose(true); if (type === 'reply' || type === 'reply-all') { diff --git a/components/email/ComposeEmail.tsx b/components/email/ComposeEmail.tsx index 4345ddfb..7e35123c 100644 --- a/components/email/ComposeEmail.tsx +++ b/components/email/ComposeEmail.tsx @@ -777,17 +777,45 @@ function LegacyAdapter({ })); }; + // Create an EmailMessage compatible object from composeBody + // This is crucial for displaying original content in replies/forwards + const createEmailMessageFromContent = (): EmailMessage | null => { + const type = determineType(); + + // Only create an email object if we're replying or forwarding + if (type === 'new' || !composeBody) { + return null; + } + + // Create a minimal EmailMessage object with the necessary fields + return { + id: 'temp-id', + messageId: '', + subject: composeSubject, + from: [{ name: '', address: '' }], + to: [{ name: '', address: '' }], + date: new Date(), + content: composeBody, + html: composeBody, + hasAttachments: false + }; + }; + // If not showing compose, return null if (!showCompose) { return null; } + // Create email message from content if available + const emailForCompose = createEmailMessageFromContent(); + const type = determineType(); + return (