-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Summary
The +send helper is great for simple emails, but there's no equivalent for creating drafts, and +send lacks support for CC/BCC, In-Reply-To, References, and thread IDs.
Current behavior
gws gmail +sendonly supports--to,--subject,--body- No
+drafthelper exists - Creating drafts requires manually constructing RFC 2822 messages, base64-encoding them, and calling
gws gmail users drafts create --json '...'— which is error-prone (encoding issues cause drafts to appear in Gmail with invisible bodies)
Proposed changes
1. Add +draft helper
Mirror +send but target drafts/create instead of messages/send:
gws gmail +draft --to alice@example.com --subject "Hello" --body "Hi Alice!"2. Add shared flags to both +send and +draft
| Flag | Purpose |
|---|---|
--cc EMAIL |
CC recipient |
--bcc EMAIL |
BCC recipient |
--in-reply-to ID |
In-Reply-To header (for threading) |
--references ID |
References header (for threading) |
--thread-id ID |
Gmail thread ID (for replies) |
Example usage
# Simple draft
gws gmail +draft --to alice@example.com --subject "Hello" --body "Hi Alice!"
# Reply draft in a thread with CC
gws gmail +draft \
--to alice@example.com \
--cc bob@example.com \
--subject "Re: Project update" \
--body "Sounds good, let's proceed." \
--thread-id 19d01b52a042ad59 \
--in-reply-to "<message-id@mail.gmail.com>"Motivation
I use the gws CLI heavily via LLM agents (Claude Code) for email workflows. The agents need to create drafts for human review before sending. Right now the only path is raw API calls with manual base64 encoding, which is brittle — the encoding has to be done in a very specific way or Gmail's UI renders the draft with an empty body. A +draft helper that handles the RFC 2822 formatting and encoding (like +send already does) would make this reliable.
The CC/threading flags would also benefit +send directly — right now any reply or CC'd email requires dropping down to the raw API.