compose mime
This commit is contained in:
parent
9a762927fc
commit
b025baa6c1
@ -1216,15 +1216,11 @@ export default function CourrierPage() {
|
||||
</nav>
|
||||
);
|
||||
|
||||
// Add back the handleReply function
|
||||
// Update handleReply function
|
||||
const handleReply = async (type: 'reply' | 'reply-all' | 'forward') => {
|
||||
if (!selectedEmail) return;
|
||||
|
||||
|
||||
try {
|
||||
// Get the decoded content first
|
||||
const decoded = await decodeEmail(selectedEmail.body);
|
||||
|
||||
// Set up the reply details
|
||||
const getReplyTo = () => {
|
||||
if (type === 'forward') return '';
|
||||
return selectedEmail.from;
|
||||
@ -1243,45 +1239,14 @@ export default function CourrierPage() {
|
||||
return subject.startsWith('Re:') ? subject : `Re: ${subject}`;
|
||||
};
|
||||
|
||||
// Create the appropriate email content based on type
|
||||
let formattedContent = '';
|
||||
if (type === 'forward') {
|
||||
formattedContent = `
|
||||
<div style="min-height: 100px;">
|
||||
<br/>
|
||||
<div style="border-top: 1px solid #e5e7eb; margin-top: 20px; padding-top: 10px; color: #666;">
|
||||
---------- Forwarded message ---------<br/>
|
||||
From: ${selectedEmail.from}<br/>
|
||||
Date: ${new Date(selectedEmail.date).toLocaleString()}<br/>
|
||||
Subject: ${selectedEmail.subject}<br/>
|
||||
To: ${selectedEmail.to}<br/>
|
||||
${selectedEmail.cc ? `Cc: ${selectedEmail.cc}<br/>` : ''}
|
||||
<br/>
|
||||
<div style="margin-top: 10px;">
|
||||
${decoded.html || decoded.text || ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
// For reply and reply-all
|
||||
formattedContent = `
|
||||
<div style="min-height: 100px;">
|
||||
<br/>
|
||||
<div style="border-left: 2px solid #e5e7eb; margin: 10px 0; padding-left: 10px; color: #666;">
|
||||
On ${new Date(selectedEmail.date).toLocaleString()}, ${selectedEmail.from} wrote:<br/>
|
||||
<br/>
|
||||
${decoded.html || decoded.text || ''}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
// Set the appropriate flags
|
||||
setIsReplying(type === 'reply' || type === 'reply-all');
|
||||
setIsForwarding(type === 'forward');
|
||||
|
||||
// Update the compose form
|
||||
setComposeTo(getReplyTo());
|
||||
setComposeCc(getReplyCc());
|
||||
setComposeSubject(getReplySubject());
|
||||
setComposeBody(formattedContent);
|
||||
setComposeBcc('');
|
||||
setShowCompose(true);
|
||||
setShowCc(type === 'reply-all');
|
||||
@ -1523,9 +1488,13 @@ export default function CourrierPage() {
|
||||
attachments={attachments}
|
||||
setAttachments={setAttachments}
|
||||
handleSend={handleSend}
|
||||
replyTo={isReplying ? selectedEmail : null}
|
||||
forwardFrom={isForwarding ? selectedEmail : null}
|
||||
onSend={(email) => {
|
||||
console.log('Email sent:', email);
|
||||
setShowCompose(false);
|
||||
setIsReplying(false);
|
||||
setIsForwarding(false);
|
||||
}}
|
||||
onCancel={() => {
|
||||
setShowCompose(false);
|
||||
@ -1537,6 +1506,8 @@ export default function CourrierPage() {
|
||||
setShowCc(false);
|
||||
setShowBcc(false);
|
||||
setAttachments([]);
|
||||
setIsReplying(false);
|
||||
setIsForwarding(false);
|
||||
}}
|
||||
/>
|
||||
{renderDeleteConfirmDialog()}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user