Skip to content

Add --draft flag to compose, reply, and forward commands#1

Open
Tobi4s1337 wants to merge 2 commits into
SeMmyT:mainfrom
Tobi4s1337:feature/draft-support
Open

Add --draft flag to compose, reply, and forward commands#1
Tobi4s1337 wants to merge 2 commits into
SeMmyT:mainfrom
Tobi4s1337:feature/draft-support

Conversation

@Tobi4s1337
Copy link
Copy Markdown

Summary

  • Adds --draft flag to mail send compose, mail send reply, and mail send forward commands
  • When --draft is passed, the email is saved to the Drafts folder instead of being sent immediately
  • Uses the Zoho Mail API's existing /messages endpoint with "mode": "draft" — no new API calls needed

Changes

  • internal/zoho/mail_types.go: Added Mode field to SendEmailRequest
  • internal/zoho/mail_send.go: Added SaveDraft() method on MailClient
  • internal/zoho/mail_service.go: Added SaveDraft() to MailService interface
  • internal/cli/mail_send.go: Added --draft flag to all three send commands with dry-run support

Usage

# Save a new email as draft
zoh mail send compose --to user@example.com --subject "Report" --body "Draft content" --draft

# Save a reply as draft
zoh mail send reply MESSAGE_ID --folder Inbox --body "Thanks!" --draft

# Save a forward as draft
zoh mail send forward MESSAGE_ID --folder Inbox --to manager@example.com --draft

# Preview with dry-run
zoh mail send compose --to user@example.com --subject "Test" --body "Hi" --draft --dry-run

Test plan

  • go build ./... compiles cleanly
  • go test ./... all tests pass
  • Manual test: zoh mail send compose --draft saves to Drafts folder
  • Manual test: zoh mail send reply --draft saves reply draft
  • Manual test: zoh mail send forward --draft saves forward draft
  • Verify drafts appear in Zoho Mail web UI

🤖 Generated with Claude Code

Tobi4s1337 and others added 2 commits February 26, 2026 12:33
Adds support for saving emails as drafts instead of sending them
immediately. Uses the Zoho Mail API's "mode": "draft" parameter
on the existing /messages endpoint.

Changes:
- Add Mode field to SendEmailRequest struct
- Add SaveDraft() method to MailClient and MailService interface
- Add --draft flag to mail send compose, reply, and forward commands
- Update dry-run previews to reflect draft mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Zoho Mail API requires fromAddress when saving drafts (unlike
sending, where it's auto-filled). SaveDraft now fetches the primary
email from account details when fromAddress is not explicitly set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant