fix: 使用 rfc822 获取邮件内容
- 使用 rfc822: true 替代 body: '.',兼容性更好 - rfc822 返回原始邮件内容,适用于所有 IMAP 服务器
This commit is contained in:
parent
5430f51885
commit
f70675412f
|
|
@ -208,15 +208,15 @@ async function scanEmails(
|
|||
}
|
||||
|
||||
try {
|
||||
// 使用 body 获取邮件内容,source 在某些 IMAP 服务器上可能不返回内容
|
||||
const msg = await client.fetchOne(uid, { uid: true, bodyStructure: true, body: '.' }, { uid: true })
|
||||
// 使用 rfc822 获取完整邮件内容(兼容性最好)
|
||||
const msg = await client.fetchOne(uid, { uid: true, rfc822: true }, { uid: true })
|
||||
if (!msg) {
|
||||
console.log(`[Scan] 邮件 ${uid} 获取失败,跳过`)
|
||||
continue
|
||||
}
|
||||
|
||||
// 优先使用 source,其次使用 body
|
||||
const rawSource = (msg as any).source || (msg as any).body
|
||||
// 优先使用 source,其次使用 rfc822
|
||||
const rawSource = (msg as any).source || (msg as any).rfc822
|
||||
if (!rawSource) {
|
||||
console.log(`[Scan] 邮件 ${uid} 无内容,跳过 (keys: ${Object.keys(msg).join(',')})`)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in New Issue