save attachment from email in customer data and - or contracts

This commit is contained in:
2026-02-03 23:58:00 +01:00
parent 9a014c100b
commit 97b4670643
8 changed files with 1037 additions and 11 deletions
+10 -10
View File
@@ -163,12 +163,12 @@ export async function fetchEmails(
return [];
}
// E-Mails abrufen
for await (const message of client.fetch(limitedUids, {
uid: true,
// E-Mails abrufen - drittes Argument { uid: true } für UID FETCH
for await (const message of client.fetch(limitedUids.join(','), {
uid: true, // UID im Response inkludieren
envelope: true,
source: true, // Vollständige E-Mail für Parsing
})) {
}, { uid: true })) {
try {
// Source muss vorhanden sein
if (!message.source) {
@@ -389,10 +389,10 @@ export async function fetchAttachment(
// E-Mail per UID abrufen
let attachment: EmailAttachmentData | null = null;
for await (const message of client.fetch([uid], {
uid: true,
// Drittes Argument { uid: true } sorgt dafür, dass UID FETCH statt FETCH verwendet wird
for await (const message of client.fetch(uid.toString(), {
source: true,
})) {
}, { uid: true })) {
if (!message.source) continue;
// E-Mail parsen
@@ -555,10 +555,10 @@ export async function fetchAttachmentList(
await client.connect();
await client.mailboxOpen(folder);
for await (const message of client.fetch([uid], {
uid: true,
// Drittes Argument { uid: true } für UID FETCH
for await (const message of client.fetch(uid.toString(), {
source: true,
})) {
}, { uid: true })) {
if (!message.source) continue;
const parsed = await simpleParser(message.source);