Install
openclaw skills install @thcjp/email-gmail-outlook基于 porteden CLI 管理和自动化配置 Gmail、Outlook、多账号邮件,实现邮件搜索、发送、回复、筛选和修改等功能。
openclaw skills install @thcjp/email-gmail-outlook核心功能: 本技能提供化流程、化工作流场景等能力。
核心功能: 本技能提供自动化配置和灵活的参数设置、化配置和灵活的参数设置等能力。
使用 porteden email(别名 porteden mail)读写当前活动账号的邮件。所有列表/搜索类操作默认带 -jc 标志(--json --compact),剥离附件详情、截断正文预览、限制标签数量,显著降低 token 消耗.
若未安装 porteden:
brew install porteden/tap/porteden
# 或
go install 相关技术文档
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| input | string | 是 | Email Gmail Outlook处理的输入数据或指令 |
| options | object | 否 | 附加配置选项,如模式选择、格式偏好等 |
| callback_url | string | 否 | 异步处理完成后的回调通知URL |
| 能力 | 免费版 | 付费版 |
|---|---|---|
| 基础功能 | 支持 | 支持 |
| 多渠道消息批量发送 | 不支持 | 支持 |
| 消息模板与变量注入 | 不支持 | 支持 |
| 送达状态实时回调 | 不支持 | 支持 |
| 通信记录归档与检索 | 不支持 | 支持 |
| 消息频控与智能排队 | 不支持 | 支持 |
| 依赖项 | 类型 | 是否必需 | 获取方式 |
|---|---|---|---|
| LLM API | API | 必需 | 由Agent内置LLM提供 |
需要配置对应API Key,详见上文环境配置章节
API Key配置方式:
export API_KEY="${API_KEY:?请设置环境变量}"
配置后需重启会话或开启新终端生效。API Key应妥善保管,避免泄露到版本控制系统.
--profile(或 PE_PROFILE 环境变量)隔离 work/personal 等多账号,任务只触及指定邮箱--today、--yesterday、--week、--days N、--after/--before 日期范围,--from、--to、--subject、--label、--unread、--has-attachment 多维筛选-q "keyword" 关键词搜索,可与日期范围组合message <id> 获取单封(默认含正文),thread <threadId> 获取完整对话send、reply、forward 支持 --cc、--bcc、--body-file、--body-type text、--importance high、--reply-allmodify 支持 --mark-read、--mark-unread、--add-labels、--remove-labels;delete 删除邮件--all 自动拉取所有分页,通过 hasMore 与 nextPageToken 控制-jc 针对AI场景优化,降低上下文 token 占用详细的输入输出格式请参考下方章节说明。
send、reply、forward、delete、modify 不可逆或对他人可见。执行前回显目标 profile/账号、消息 ID(或收件人列表)与预期变更,等待用户确认后再执行--profile 隔离账号,登录时使用最窄 provider 范围;任务完成后(尤其共享机器)执行 porteden auth logout 清除 keyring 条目,必要时在 provider 账户安全页撤销 token-jc 预览输出,仅在用户明确需要完整正文时使用 --include-body 或获取单封 message| 风险项 | 等级 | 防护措施 | 验证方法 |
|---|---|---|---|
| API密钥泄露 | 高 | 通过环境变量配置,禁止硬编码 | 定期检查代码和配置文件 |
| 命令执行风险 | 高 | 仅执行白名单命令,避免拼接用户输入 | 使用沙箱环境测试 |
| 网络通信安全 | 中 | 使用HTTPS协议,验证SSL证书 | 定期检查证书有效期 |
| 敏感数据暴露 | 高 | 输出结果中不包含密钥、令牌等敏感信息 | 日志脱敏审查 |
| 未授权访问 | 中 | 限制访问权限,实施认证机制 | 定期审计访问日志 |
brew install porteden/tap/portedenporteden auth login 打开浏览器,凭证存入系统 keyringporteden auth login --token <key> 存入 keyringPE_API_KEY,CLI 自动使用,无需登录porteden auth statusexport PE_PROFILE=work,避免每次输入 --profile# 今日邮件
porteden email messages -jc
# 本周邮件(自动分页)
porteden email messages --week --all -jc
# 按发件人筛选
porteden email messages --from sender@example.com -jc
# 关键词搜索 + 日期范围
porteden email messages -q "合同" --after 2026-07-01 --before 2026-07-20 -jc
# 未读且带附件
porteden email messages --unread --has-attachment -jc
# 获取单封(默认含正文)
porteden email message google:abc123 -jc
# 获取完整线程
porteden email thread m365:xyz789 -jc
# 发送
porteden email send --to user@example.com --subject "项目周报" --body "本周完成 3 个里程碑"
# 命名收件人
porteden email send --to "张三 <zhangsan@example.com>" --subject "Hi" --body "你好"
# 回复(全部回复加 --reply-all)
porteden email reply google:abc123 --body "已收到,本周内反馈"
# 转发
porteden email forward m365:xyz789 --to colleague@example.com --body "FYI"
# 标记已读 + 加 IMPORTANT 标签
porteden email modify google:abc123 --mark-read --add-labels IMPORTANT
# 移出收件箱
porteden email modify m365:xyz789 --remove-labels INBOX
# 删除
porteden email delete google:abc123
# 1. 列出本周未读邮件
porteden email messages --week --unread -jc
# ...
# 输出示例(截断):
# [
# { "id": "google:abc123", "from": "boss@company.com", "subject": "项目进度汇报", "unread": true },
# { "id": "m365:xyz789", "from": "finance@bank.com", "subject": "账单提醒", "unread": true }
# ]
# ...
# 2. 对高优先级邮件标记重要(执行前回显确认)
porteden email modify google:abc123 --add-labels IMPORTANT
porteden email modify google:abc123 --mark-read
# 1. 查找带附件的未读邮件
porteden email messages --unread --has-attachment -jc
# ...
# 2. 获取单封正文(用户明确需要时)
porteden email message google:abc123 -jc
# ...
# 3. 回复(执行前回显收件人、消息 ID、正文)
porteden email reply google:abc123 --body "附件已收到,本周内评审反馈" --reply-all
# 在 work 账号搜索
porteden email messages --profile work -q "Q3 财报" --week -jc
# ...
# 在 personal 账号搜索
porteden email messages --profile personal -q "Q3 财报" --week -jc
# ...
# 合并结果后统一展示
porteden 报 command not foundbrew install porteden/tap/porteden(macOS/Linux)或 `go install 相关技术文档 Go 环境)porteden email messages 返回 401 Unauthorizedporteden auth login 重新登录;若使用 PE_API_KEY,检查环境变量是否过期并更新--profile work 报 profile not foundporteden auth status 查看已配置 profile 列表,确认 PE_PROFILE 环境变量或 --profile 参数指向已登录的 profileporteden email message abc123 报 ID not foundgoogle:abc123、m365:xyz789),从 messages 命令的 JSON 输出原样复制完整 ID--all 自动分页设置合理间隔porteden auth login 报 keyring access deniedgnome-keyring 或 kwallet 服务运行;Windows 检查 Credential Manager 服务;或改用 PE_API_KEY 环境变量message 命令输出正文过长,超出 Agent 上下文窗口-jc 预览模式;仅在需要时获取单封 message;超长正文改用 --body-file 写入文件后处理send 或 reply 同时指定 --body 与 --body-file 报参数冲突--body,长正文或含模板的用 --body-file 指向文件路径使用 --profile work 或 --profile personal 指定账号;或设置环境变量 export PE_PROFILE=work 作为默认 profile。每个 profile 独立登录,凭证隔离存储在系统 keyring.
-jc 是 --json --compact 简写,剥离附件详情、截断正文预览、限制标签,适合列表/搜索场景降低 token。--include-body 在 messages 命令上拉取完整正文(默认仅预览);单封 message 默认含正文。AI 场景默认用 -jc,仅在用户明确需要完整正文时加 --include-body.
凭证存入系统 keyring:macOS Keychain、Windows Credential Manager、Linux Secret Service(gnome-keyring/kwallet)。撤销分两步:① porteden auth logout 清除本地 keyring 条目;② 登录 provider(Google/Microsoft)账户安全页撤销 token 授权。共享机器任务结束务必执行撤销.
列表查询用 -jc 仅获取预览;对目标邮件用 porteden email message <id> -jc 获取单封正文;若正文仍过长,改用 porteden email message <id> --body-file /tmp/body.txt 写入文件,再由 Agent 按需读取文件片段.
messages 命令默认返回单页,检查 JSON 输出的 hasMore 与 nextPageToken 字段。加 --all 自动拉取所有分页。超大结果集(>500 封)建议结合 --after/--before 日期范围或 --from 筛选分批处理,避免单次 token 超限.
porteden 用 provider:id 格式区分不同邮箱 provider(如 google:abc123、m365:xyz789)。前缀确保跨 provider 唯一性,调用 message、reply、forward、modify、delete 时必须原样传入完整 ID,不可省略前缀.
| 错误场景 | 原因 | 处理方式 |
|---|---|---|
| LLM响应超时或无响应 | 网络延迟或模型负载过高 | 请求重试;确认Agent平台LLM服务正常 |
| 输入内容格式不正确 | 用户输入不符合skill预期格式 | 检查输入是否符合skill使用说明中的格式要求,参考示例章节 |
| 执行结果与预期不符 | 指令描述不够明确或上下文不足 | 提供更详细的指令描述,补充必要的上下文信息 |
| 命令执行失败 | 运行环境不满足要求或权限不足 | 确认运行环境符合依赖说明中的要求;检查命令权限设置 |
-jc 输出仅含附件元数据(文件名、大小、类型),不下载附件内容--body-type text 可发送纯文本| 操作步骤 | 手动耗时 | 自动化耗时 | 时间节约 | 准确率提升 |
|---|---|---|---|---|
| 邮件筛选 | 10分钟 | 1分钟 | 9分钟 | 10% |
| 批量回复 | 1小时 | 15分钟 | 45分钟 | 15% |
| 邮件归档 | 30分钟 | 5分钟 | 25分钟 | 20% |
| 邮件发送 | 5分钟 | 1分钟 | 4分钟 | 10% |
| 邮件搜索 | 15分钟 | 2分钟 | 13分钟 | 15% |
| 对比维度 | 本技能 | 手动操作 | Python脚本 | 专业软件 |
|---|---|---|---|---|
| 操作便捷性 | 高 | 低 | 中 | 高 |
| 功能丰富度 | 高 | 低 | 中 | 高 |
| 个性化配置 | 中 | 低 | 低 | 高 |
| 成本效益 | 高 | 低 | 中 | 高 |
| 学习曲线 | 低 | 高 | 中 | 高 |
| 痛点 | 描述 | 影响范围 | 解决方案 | 量化效果 |
|---|---|---|---|---|
| 邮件管理效率低 | 邮件数量多,手动操作耗时 | 影响工作效率 | 自动化邮件管理 | 时间节约20% |
| 邮件安全风险 | 邮件内容可能泄露 | 影响信息安全 | 安全凭证存储 | 安全风险降低30% |
| 邮件搜索困难 | 邮件数量多,查找困难 | 影响工作效率 | 全文搜索功能 | 搜索效率提升15% |
| 错误现象 | 可能原因 | 诊断步骤 | 解决方案 |
|---|---|---|---|
| 无法登录邮箱 | API Key配置错误 | 检查API Key配置是否正确 | 重新配置API Key |
| 邮件发送失败 | 网络连接问题 | 检查网络连接 | 修复网络连接 |
| 邮件搜索结果不准确 | 搜索条件设置错误 | 检查搜索条件 | 修改搜索条件 |
| 邮件无法删除 | 权限问题 | 检查权限 | 修改权限 |
| 邮件无法修改 | 权限问题 | 检查权限 | 修改权限 |