fix: 使用 body: '' 获取邮件内容
- 使用 body: '' 替代 rfc822: true,尝试获取完整邮件内容 - 添加多种获取方式的回退逻辑
This commit is contained in:
parent
f70675412f
commit
c2715d78d3
|
|
@ -208,15 +208,15 @@ async function scanEmails(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 使用 rfc822 获取完整邮件内容(兼容性最好)
|
// 使用 body: '' 获取完整邮件内容
|
||||||
const msg = await client.fetchOne(uid, { uid: true, rfc822: true }, { uid: true })
|
const msg = await client.fetchOne(uid, { uid: true, body: '' }, { uid: true })
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
console.log(`[Scan] 邮件 ${uid} 获取失败,跳过`)
|
console.log(`[Scan] 邮件 ${uid} 获取失败,跳过`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先使用 source,其次使用 rfc822
|
// 尝试多种方式获取邮件内容
|
||||||
const rawSource = (msg as any).source || (msg as any).rfc822
|
const rawSource = (msg as any).source || (msg as any).body || (msg as any).rfc822
|
||||||
if (!rawSource) {
|
if (!rawSource) {
|
||||||
console.log(`[Scan] 邮件 ${uid} 无内容,跳过 (keys: ${Object.keys(msg).join(',')})`)
|
console.log(`[Scan] 邮件 ${uid} 无内容,跳过 (keys: ${Object.keys(msg).join(',')})`)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue