feat: add outlook mail mode selection#12
Open
zhezzma wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本次修改为 Outlook 邮箱账号增加了显式的邮件拉取模式配置。
原先 Outlook 邮箱默认只通过 IMAP 拉取邮件。如果某些 Outlook / Microsoft 邮箱没有开启 IMAP,即使 OAuth Refresh Token 可以正常刷新,IMAP 认证或选择收件箱时仍然会失败。
本次改动允许每个 Outlook 账号单独指定使用 imap 还是 graph,从而避免无效的 IMAP 请求,也方便后续查看和维护账号配置。
主要改动
Outlook 账号导入格式新增第 5 个字段:
保持兼容原有 4 段格式:
如果没有最后的 imap/graph 字段,则默认使用 imap。
accounts.json 中新增 mode 字段,用于保存该账号的邮件拉取方式:
{ "email": "...", "password": "...", "clientId": "...", "refreshToken": "...", "mode": "graph" }启动任务读取账号时,会读取并保留 mode 字段。
新增 Microsoft Graph 邮件读取逻辑,支持:
邮件拉取逻辑调整为按账号模式直连:
更新前端导入提示和占位文本,展示新的可选格式。
修改原因
部分 Outlook / Microsoft 邮箱即使授权 Token 正常,也可能因为 IMAP 未开启而无法通过 IMAP 读取邮件,常见错误类似:
而这些账号通过 Microsoft Graph 仍然可以正常读取邮件。
通过给账号增加显式的 imap/graph 模式,可以:
兼容性
本次改动保持向后兼容: