Rainnystone

Outlook Ews Manager — Development skill for Claude Code

Development community

世纪互联版 M365(partner.outlook.cn)邮箱工具:IMAP 被禁时走 EWS+OAuth 收件/转发,SMTP 发件.

How to install Outlook Ews Manager

This entry records only its repository, not the path inside it, so there is no exact command to give. Open Rainnystone/outlook-ews-manager and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Outlook Ews Manager does

世纪互联版 M365(partner.outlook.cn)邮箱工具:IMAP 被禁时走 EWS+OAuth 收件/转发,SMTP 发件。Agent skill for Kimi Code / Codex / Claude Code.

Alternatives in Development

  • Brainstorm — Start a creative thought partner brainstorming session 2.8k ★
  • Claude Balancer — A load balancer proxy for multiple Claude OAuth accounts with automatic failover, request tracking, and web da 910 ★
  • Hermes Claude Auth — Claude Code OAuth bypass for hermes-agent 374 ★

README

outlook-ews-manager

**中文** | [English](README.en.md)

在**世纪互联版 Microsoft 365**(21Vianet 运营,`partner.outlook.cn`)邮箱被租户禁用 IMAP 的情况下,照样收信、搜索、转发、发信。纯 Python 命令行工具 + agent skill(SKILL.md),兼容 **Kimi Code / Codex / Claude Code** 及所有遵循 SKILL.md 规范的 agent runtime,零第三方依赖。

解决什么问题

公司邮箱在所有 IMAP 客户端里都报 `AUTHENTICATE failed`,密码明明是对的。原因通常是租户在邮箱或组织级别禁用了 IMAP(`Set-CASMailbox -ImapEnabled $false` 或认证策略),不是密码错。但 **EWS(Exchange Web Services)+ OAuth 通常仍然开放**——Foxmail 就是这么绕的。本工具走同样的路:

通道 协议 认证 用途
EWS SOAP over HTTPS OAuth2 设备码授权,refresh token 滚动续期 收件 / 搜索 / 读正文 / 下载附件 / 原生转发
SMTP STARTTLS,587 端口 账号密码 发新邮件

转发使用 EWS 原生 `ForwardItem`,自动保留完整邮件链与全部附件,Outlook 客户端能正确识别为转发。

安装

需要 Python 3.7+(只用标准库,无需 pip install)。把整个目录拷到任一 skill 路径:

Runtime 路径
Kimi Code ~/.kimi-code/skills/outlook-ews-manager/
Codex CLI ~/.codex/skills/outlook-ews-manager/
Claude Code ~/.claude/skills/outlook-ews-manager/
通用 ~/.agents/skills/outlook-ews-manager/

也可以只当普通命令行工具用,脚本在任何目录都能跑。

快速开始

cd outlook-ews-manager
cp .env.example .env      # 填入 SMTP 账号密码、EWS_USER
python3 scripts/setup.py  # 一次性:SMTP 验证 + 浏览器扫码 OAuth 授权

凭据本地存放、仅本人可读(`chmod 600`):SMTP 密码在 `.env`,refresh token 在 `token.json`(flock + 原子写回,约 90 天滚动续期)。**初始化后所有命令直接可用,不做重复检测**;仅当报"认证失效"时重跑 `setup.py`。

python3 scripts/ews.py check --limit 10              # 最新邮件(* 为未读)
python3 scripts/ews.py search --from boss@corp.com   # 服务端过滤搜索
python3 scripts/ews.py fetch 1                       # 读正文
python3 scripts/ews.py download 1 --dir ~/Downloads  # 下载附件
python3 scripts/ews.py reply 1 --body "收到"         # 原生回复(--all 回复全部,--attach 带附件)
python3 scripts/ews.py forward 1 --to x@y.com        # 转发预览;加 --confirm-send 才发送
python3 scripts/smtp.py send --to x@y.com --subject "主题" --body "正文"

发信与转发均为两段式:先预览,明确确认后才真正发送。完整用法见 [SKILL.md](SKILL.md);踩坑记录(IMAP 判别、设备码端点参数名、EWS 命名空间等)见 [references/troubleshooting.md](references/troubleshooting.md)。