Skip to content

Commit 587511e

Browse files
committed
Merge remote-tracking branch 'origin/staging'
2 parents 839fffa + e6c6f26 commit 587511e

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

server/routes/receive-email/imap-server/email.ts

+22-10
Original file line numberDiff line numberDiff line change
@@ -341,27 +341,39 @@ export async function fetchEmails() {
341341
if (processedUids.length > 0) {
342342
try {
343343
const mailboxes = await client.list();
344-
const trashMailbox = mailboxes.find(
344+
345+
let trashPath = "Trash";
346+
347+
const ovhTrash = mailboxes.find(
345348
(box) =>
346-
box.specialUse === "\\Trash" ||
347-
box.path.toLowerCase().includes("trash") ||
348-
box.path.toLowerCase().includes("corbeille")
349+
box.path === "INBOX.INBOX.Trash" || box.path === "INBOX.Trash"
349350
);
350351

351-
const trashPath = trashMailbox ? trashMailbox.path : "Trash";
352+
if (ovhTrash) {
353+
trashPath = ovhTrash.path;
354+
} else {
355+
const trashMailbox = mailboxes.find(
356+
(box) =>
357+
box.specialUse === "\\Trash" ||
358+
box.path.toLowerCase().includes("trash") ||
359+
box.path.toLowerCase().includes("corbeille")
360+
);
361+
362+
if (trashMailbox) {
363+
trashPath = trashMailbox.path;
364+
}
365+
}
352366

353367
console.log(
354-
`🗑️ Déplacement de ${processedUids.length} emails traités vers la corbeille...`
368+
`🗑️ Déplacement de ${processedUids.length} emails vers ${trashPath}...`
355369
);
356370
await client.messageMove(processedUids, trashPath);
357371
console.log(
358372
`✅ ${processedUids.length} emails déplacés vers la corbeille`
359373
);
360374
} catch (moveError) {
361-
console.error(
362-
"❌ Erreur lors du déplacement des emails vers la corbeille:",
363-
moveError
364-
);
375+
console.error("❌ Erreur lors du déplacement des emails:", moveError);
376+
console.error(moveError);
365377
}
366378
}
367379
} finally {

server/routes/receive-email/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ if (process.env.APP_ENV === "production" || process.env.APP_ENV === "staging") {
1212
fetchEmails().catch((error) => {
1313
console.error("Erreur lors de la vérification des emails:", error);
1414
});
15-
}, 200 * 500);
15+
}, 15 * 60 * 1000);
16+
// 15 minutes = 900 000 ms
1617
} else {
1718
console.log(
1819
"Mode développement ou staging: vérification des emails désactivée"

0 commit comments

Comments
 (0)