diff --git a/content/mail-163.js b/content/mail-163.js index 5455a5a..b5e5a46 100644 --- a/content/mail-163.js +++ b/content/mail-163.js @@ -145,6 +145,14 @@ function getMailTimestamp(item) { return null; } +function scheduleEmailCleanup(item, step) { + setTimeout(() => { + Promise.resolve(deleteEmail(item, step)).catch(() => { + // Cleanup is best effort only and must never affect the main verification flow. + }); + }, 0); +} + // ============================================================ // Email Polling // ============================================================ @@ -242,10 +250,8 @@ async function handlePollEmail(step, payload) { const timeLabel = mailTimestamp ? `,时间:${new Date(mailTimestamp).toLocaleString('zh-CN', { hour12: false })}` : ''; log(`步骤 ${step}:已找到验证码:${code}(来源:${source}${timeLabel},主题:${subject.slice(0, 40)})`, 'ok'); - // Delete this email via right-click menu, WAIT for it to finish before returning - await deleteEmail(item, step); - // Extra wait to ensure deletion is processed - await sleep(1000); + // Trigger cleanup only as a best-effort side effect. + scheduleEmailCleanup(item, step); return { ok: true, code, emailTimestamp: Date.now(), mailId: id }; } else if (code && seenCodes.has(code)) {