Add --draft flag to compose, reply, and forward commands#1
Open
Tobi4s1337 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--draftflag tomail send compose,mail send reply, andmail send forwardcommands--draftis passed, the email is saved to the Drafts folder instead of being sent immediately/messagesendpoint with"mode": "draft"— no new API calls neededChanges
internal/zoho/mail_types.go: AddedModefield toSendEmailRequestinternal/zoho/mail_send.go: AddedSaveDraft()method onMailClientinternal/zoho/mail_service.go: AddedSaveDraft()toMailServiceinterfaceinternal/cli/mail_send.go: Added--draftflag to all three send commands with dry-run supportUsage
Test plan
go build ./...compiles cleanlygo test ./...all tests passzoh mail send compose --draftsaves to Drafts folderzoh mail send reply --draftsaves reply draftzoh mail send forward --draftsaves forward draft🤖 Generated with Claude Code