updates
This commit is contained in:
@@ -13,6 +13,7 @@ interface EmailMessage {
|
||||
timestamp: string;
|
||||
direction: 'sent' | 'received';
|
||||
threadId?: string;
|
||||
attachments?: any[];
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
@@ -304,6 +305,15 @@ async function fetchImapEmails(
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract attachments
|
||||
const attachments = parsed.attachments ? parsed.attachments.map((att: any) => ({
|
||||
filename: att.filename || 'attachment',
|
||||
name: att.filename || 'attachment',
|
||||
size: att.size || 0,
|
||||
type: att.contentType || 'application/octet-stream',
|
||||
cid: att.cid || undefined
|
||||
})) : [];
|
||||
|
||||
const email: EmailMessage = {
|
||||
id: parsed.messageId || `${Date.now()}-${seqno}`,
|
||||
from: fromEmail,
|
||||
@@ -312,7 +322,8 @@ async function fetchImapEmails(
|
||||
body: parsed.text || '',
|
||||
html: parsed.html || undefined,
|
||||
timestamp: parsed.date?.toISOString() || new Date().toISOString(),
|
||||
direction: fromEmail.toLowerCase().includes(userEmail.toLowerCase()) ? 'sent' : 'received'
|
||||
direction: fromEmail.toLowerCase().includes(userEmail.toLowerCase()) ? 'sent' : 'received',
|
||||
attachments: attachments
|
||||
};
|
||||
|
||||
if (parsed.headers.has('in-reply-to')) {
|
||||
|
||||
@@ -181,7 +181,8 @@ export default defineEventHandler(async (event) => {
|
||||
html: htmlBody,
|
||||
timestamp: new Date().toISOString(),
|
||||
direction: 'sent',
|
||||
interestId: interestId
|
||||
interestId: interestId,
|
||||
attachments: attachments // Include attachment info
|
||||
};
|
||||
|
||||
const objectName = `interest-${interestId}/${Date.now()}-sent.json`;
|
||||
|
||||
Reference in New Issue
Block a user