panel 2 courier
This commit is contained in:
parent
5f17baf88e
commit
806ddaa73e
@ -77,10 +77,8 @@ export async function GET(request: Request) {
|
|||||||
envelope: true,
|
envelope: true,
|
||||||
flags: true,
|
flags: true,
|
||||||
bodyStructure: true,
|
bodyStructure: true,
|
||||||
bodyParts: [
|
source: true, // Get the full email source
|
||||||
'text/plain',
|
bodyParts: ['text/plain', 'text/html'] // Get both text and HTML content
|
||||||
'text/html'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for await (const message of messages) {
|
for await (const message of messages) {
|
||||||
@ -88,8 +86,7 @@ export async function GET(request: Request) {
|
|||||||
let content = '';
|
let content = '';
|
||||||
if (message.bodyParts) {
|
if (message.bodyParts) {
|
||||||
// Prefer HTML content if available
|
// Prefer HTML content if available
|
||||||
content = message.bodyParts.get('text/html')?.toString() ||
|
content = message.bodyParts.get('text/html')?.toString() || message.bodyParts.get('text/plain')?.toString() || '';
|
||||||
message.bodyParts.get('text/plain')?.toString() || '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
@ -104,7 +101,8 @@ export async function GET(request: Request) {
|
|||||||
folder: mailbox.path,
|
folder: mailbox.path,
|
||||||
hasAttachments: message.bodyStructure?.type === 'multipart',
|
hasAttachments: message.bodyStructure?.type === 'multipart',
|
||||||
flags: Array.from(message.flags),
|
flags: Array.from(message.flags),
|
||||||
content: content
|
content: content,
|
||||||
|
source: message.source?.toString() || '' // Include full email source for parsing
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user