diff --git a/components/email/ComposeEmail.tsx b/components/email/ComposeEmail.tsx index 5366bf19..17cfcacc 100644 --- a/components/email/ComposeEmail.tsx +++ b/components/email/ComposeEmail.tsx @@ -317,12 +317,39 @@ export default function ComposeEmail(props: ComposeEmailProps) { setSending(true); try { + // Generate the final email content + let finalContent = emailContent; + + // For reply or forward, combine the user's new content with the quoted content + if (type === 'reply' || type === 'reply-all' || type === 'forward') { + // Get the new content from the editor + const editorContent = document.querySelector('.ql-editor')?.innerHTML || ''; + + // Get the original header (either reply or forward header) + const headerContent = type === 'forward' + ? emailContent.split('
]*>([\s\S]*?)<\/blockquote>/i); + const quotedContent = quotedMatch ? quotedMatch[0] : ''; + + // Combine them + finalContent = ` ++ ${editorContent} ++ ${headerContent} + ${quotedContent} + `; + } + await onSend({ to, cc: cc || undefined, bcc: bcc || undefined, subject, - body: emailContent, + body: finalContent, fromAccount: selectedAccount?.id, attachments }); @@ -483,14 +510,75 @@ export default function ComposeEmail(props: ComposeEmailProps) { {/* Message Body */} -+ {(type === 'forward' || type === 'reply' || type === 'reply-all') ? ( + + {/* Editable area for user's reply */} ++ ) : ( + // Regular editor for new emails +++ + {/* Read-only display of original email with professional formatting */} ++ + {type === 'reply' || type === 'reply-all' ? ( ++ + {/* Hidden field to store the complete content for sending */} + ++ {/* Get the reply header from the email content */} + {initialEmail && ( + + )} ++ ) : type === 'forward' ? ( ++ {/* Get the forward header from the email content */} + {initialEmail && ( + + )} ++ ) : null} + + {/* Display the original content with the same quality as Panel 3 */} ++ {initialEmail && initialEmail.content && ( +++ )} + + )} {/* Attachments */} {attachments.length > 0 && (