From 806ddaa73eedff328adaf023856e7bb6df966b6f Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 25 Apr 2025 11:37:28 +0200 Subject: [PATCH] panel 2 courier --- app/api/courrier/route.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/api/courrier/route.ts b/app/api/courrier/route.ts index bd03a8de..e5ab7b8b 100644 --- a/app/api/courrier/route.ts +++ b/app/api/courrier/route.ts @@ -77,10 +77,8 @@ export async function GET(request: Request) { envelope: true, flags: true, bodyStructure: true, - bodyParts: [ - 'text/plain', - 'text/html' - ] + source: true, // Get the full email source + bodyParts: ['text/plain', 'text/html'] // Get both text and HTML content }); for await (const message of messages) { @@ -88,8 +86,7 @@ export async function GET(request: Request) { let content = ''; if (message.bodyParts) { // Prefer HTML content if available - content = message.bodyParts.get('text/html')?.toString() || - message.bodyParts.get('text/plain')?.toString() || ''; + content = message.bodyParts.get('text/html')?.toString() || message.bodyParts.get('text/plain')?.toString() || ''; } result.push({ @@ -104,7 +101,8 @@ export async function GET(request: Request) { folder: mailbox.path, hasAttachments: message.bodyStructure?.type === 'multipart', flags: Array.from(message.flags), - content: content + content: content, + source: message.source?.toString() || '' // Include full email source for parsing }); }