进阶教程 较易 45 分钟

OpenClaw 办公实战:邮件分诊与每日晨报

在已部署的 OpenClaw 上接入 Gmail,让 AI 按规则自动打标签、汇总未读,再用 cron 每天早上 8 点把日历安排、邮件摘要和待办推送成一份晨报。部署可先参考 /tutorials/deploy-local/ 教程,OpenClaw 的能力概览见 /office-agents/openclaw/。

#Office Automation #OpenClaw #Email

准备工作

  • A deployed OpenClaw instance (see the /tutorials/deploy-local/ tutorial)
  • A Gmail account
  • A configured model API key

操作步骤

1

连接 Gmail 账号

OpenClaw 内置原生 Gmail 集成,可以读取、草拟和管理你的收件箱。在管理界面发起连接,按提示完成 Google OAuth 授权即可开始使用。

小提示

  • For the first connection, use a test mailbox and switch to your primary one only after the behavior checks out
  • If authorization fails, first confirm your deployment can reach Google services
2

在 SOUL.md 写入安全护栏

SOUL.md 是 OpenClaw 的人格与规则文件。在里面加一条硬性规则:任何发邮件的动作必须先生成草稿,等待人工确认后才能发送。这是社区总结的最佳实践,能有效防止误发邮件。

小提示

  • The more specific the rule, the more reliable — e.g., 'Never send, reply to, or forward any email without my confirmation'
  • After editing, ask OpenClaw to recite the rule to confirm it stuck
3

设置邮件分诊规则

用自然语言告诉 OpenClaw 你希望邮件如何分类:按发件人或主题自动打标签,并把未读邮件汇总成一份简短清单。不需要写任何代码。

小提示

  • Start with just a few labels (e.g., 'clients', 'bills', 'notifications') — far easier to maintain than a dozen categories on day one
  • When a message is mislabeled, tell OpenClaw the correct answer and let it adjust the rules
4

配置每天早上 8 点的晨报

新建一个 cron 定时任务,让 OpenClaw 每天早上 8 点汇总当日日历安排、邮件摘要和待办事项,推送到你的 WhatsApp 或 Telegram。

小提示

  • Have the briefing follow a fixed template so you can scan it at a glance
  • Add a failure notification to the cron job so a missed briefing surfaces immediately
5

设置用量上限,锁住 API 成本

邮件分诊和定时晨报会持续消耗模型调用,务必在 OpenClaw 中设置用量上限。社区有用户因未设上限导致成本失控的真实案例(被戏称为「$120 disaster」),别让账单替你发现这个问题。

小提示

  • Set the cap low first, watch real usage for a week or two, then raise it gradually
  • Also set a hard spending limit at your model provider as a last line of defense
6

渐进放量:先草稿,再自动化

第一周只观察 OpenClaw 生成的邮件草稿质量,每一封都人工确认。草稿稳定达标后,再逐步放开自动打标签、自动归档等低风险动作。

小提示

  • Enable actions one at a time in this order: labeling → archiving → drafting replies, observing each for a few days
  • Keep human confirmation on anything that sends email externally — permanently

常见问题

Gmail 授权失败怎么办?
先确认部署环境能正常访问 Google 服务,再检查登录的 Google 账号是否正确。反复失败时,到 Google 账号的安全设置里撤销对应用的授权,然后重新发起 OAuth 授权。
API 成本超出预期?
检查是否有自动化任务在高频触发模型调用,先停掉非必要任务,再在 OpenClaw 中设置用量上限,并在模型服务商后台设置消费硬上限。
晨报推送时间不对?
cron 任务按部署环境的系统时区执行,和你的本地时间可能不一致。先检查服务器的系统时区,必要时将其设置为你所在的时区(如 Asia/Shanghai),再重新保存定时任务。