Skip to content

Commit 4067cc6

Browse files
committed
feat(gmail): add autoreply command
1 parent 4b06fab commit 4067cc6

File tree

7 files changed

+692
-15
lines changed

7 files changed

+692
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Added
6+
- Gmail: add `gmail autoreply` to reply once to matching messages, label the thread for dedupe, and optionally archive/mark read. Includes docs and regression coverage for skip/reply flows.
7+
38
## 0.12.0 - 2026-03-09
49

510
### Highlights

docs/gmail-autoreply.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
summary: "Reply once to matching Gmail messages with gog"
3+
read_when:
4+
- Adding Gmail email automation
5+
- Setting up mailbox auto-replies without Gmail templates
6+
---
7+
8+
# Gmail auto-reply
9+
10+
`gog gmail autoreply` is a one-shot command.
11+
12+
Use it on a schedule with `launchd`, cron, or another runner when Gmail's native filter API is not enough.
13+
14+
## Example
15+
16+
Reply once to mail sent to `security@openclaw.ai`, add a dedupe label, then archive:
17+
18+
```bash
19+
gog -a clawdbot@gmail.com gmail autoreply \
20+
'to:security@openclaw.ai in:inbox -label:SecurityAutoReplied' \
21+
--body-file ./security-autoreply.txt \
22+
--label SecurityAutoReplied \
23+
--archive \
24+
--mark-read
25+
```
26+
27+
Recommended reply text:
28+
29+
```text
30+
Thanks for contacting OpenClaw Security.
31+
32+
For fastest triage, please submit security reports privately via GitHub:
33+
https://github.com/openclaw/openclaw/security/advisories/new
34+
35+
If you cannot use GitHub or are unsure which repo is affected, reply to this email.
36+
```
37+
38+
## Notes
39+
40+
- The command is idempotent per thread via the post-reply label.
41+
- It sends replies in-thread with `In-Reply-To` and `References`.
42+
- It adds `Auto-Submitted: auto-replied` and suppresses common auto-response loops.
43+
- By default it skips bulk/list/auto-generated mail.

internal/cmd/gmail.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ type GmailCmd struct {
2020
Unread GmailUnreadCmd `cmd:"" name:"unread" aliases:"mark-unread" group:"Organize" help:"Mark messages as unread"`
2121
Trash GmailTrashMsgCmd `cmd:"" name:"trash" group:"Organize" help:"Move messages to trash"`
2222

23-
Send GmailSendCmd `cmd:"" name:"send" group:"Write" help:"Send an email"`
24-
Track GmailTrackCmd `cmd:"" name:"track" group:"Write" help:"Email open tracking"`
25-
Drafts GmailDraftsCmd `cmd:"" name:"drafts" aliases:"draft" group:"Write" help:"Draft operations"`
23+
Send GmailSendCmd `cmd:"" name:"send" group:"Write" help:"Send an email"`
24+
AutoReply GmailAutoReplyCmd `cmd:"" name:"autoreply" group:"Write" help:"Reply once to matching messages"`
25+
Track GmailTrackCmd `cmd:"" name:"track" group:"Write" help:"Email open tracking"`
26+
Drafts GmailDraftsCmd `cmd:"" name:"drafts" aliases:"draft" group:"Write" help:"Draft operations"`
2627

2728
Settings GmailSettingsCmd `cmd:"" name:"settings" group:"Admin" help:"Settings and admin"`
2829

0 commit comments

Comments
 (0)