diff --git a/app/mail/page.tsx b/app/mail/page.tsx index fbe77f7..ad1605b 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -1305,14 +1305,31 @@ export default function MailPage() { case 'reply': return selectedEmail.from; case 'replyAll': - // Combine from and cc, excluding current user's email - const addresses = new Set([selectedEmail.from, ...(selectedEmail.cc?.split(',') || [])]); - return Array.from(addresses).filter(addr => addr !== accounts[1]?.email).join(', '); + // For Reply All, only put the original sender in To + return selectedEmail.from; case 'forward': return ''; } }; + const getReplyCc = () => { + if (type === 'replyAll') { + // For Reply All, put all other recipients in CC, excluding the sender and current user + const allRecipients = new Set([ + ...(selectedEmail.to?.split(',') || []), + ...(selectedEmail.cc?.split(',') || []) + ]); + // Remove the sender and current user from CC + allRecipients.delete(selectedEmail.from); + allRecipients.delete(accounts[1]?.email); + return Array.from(allRecipients) + .map(email => email.trim()) + .filter(email => email) // Remove empty strings + .join(', '); + } + return ''; + }; + const getReplyBody = () => { try { const parsed = parseFullEmail(selectedEmail.body); @@ -1330,7 +1347,7 @@ export default function MailPage() { .replace(/]*>/gi, '\n') .replace(/<\/p>/gi, '') .replace(/<[^>]+>/g, '') - .replace(/ |‌|»|«|>|<|&/g, match => { + .replace(/ |‌|»|«|>/g, match => { switch (match) { case ' ': return ' '; case '‌': return ''; @@ -1415,9 +1432,10 @@ export default function MailPage() { setComposeTo(getReplyTo()); setComposeSubject(getReplySubject()); setComposeBody(getReplyBody()); - setComposeCc(''); + setComposeCc(getReplyCc()); setComposeBcc(''); - setShowCc(false); + // Show CC field automatically for Reply All + setShowCc(type === 'replyAll'); setShowBcc(false); setAttachments([]); };