Skip to content

feat(mail): add --reply-to-message-id to drafts create#15

Open
okuegow wants to merge 1 commit into
visionik:mainfrom
okuegow:feat/mail-reply-draft
Open

feat(mail): add --reply-to-message-id to drafts create#15
okuegow wants to merge 1 commit into
visionik:mainfrom
okuegow:feat/mail-reply-draft

Conversation

@okuegow

@okuegow okuegow commented Jun 28, 2026

Copy link
Copy Markdown

What

Adds a --reply-to-message-id <id> flag to mog mail drafts create.

When set, the draft is created as a threaded reply via Graph's createReply action (which keeps the quoted original and conversation threading) and is left in the Drafts folder for review instead of being sent. This complements the existing mail send --reply-to-message-id, which sends immediately — the new flag is for the "draft, review, then send" workflow.

Behaviour

  • --to / --subject become optional. Recipients default to the original sender (filled in by createReply) and are only overridden when --to/--cc/--bcc are supplied.
  • Also adds --cc / --bcc to mail drafts create for the non-reply case (previously unavailable).
  • The user's --body/--body-file text is passed as the createReply comment so it lands above the quoted original.
  • If setting recipients fails after the draft exists, deletion of the half-built draft is attempted and the deletion outcome is reported in the error — so the message never claims the draft was "removed" when it actually remains.
  • --body-file read errors are now wrapped consistently with mail send.

Tests

TestMailDraftsCreateCmd_Reply covers: createReply is used and the draft is never sent; the user text rides along as the comment; recipients are patched only when supplied (otherwise the original sender is kept); createReply API errors surface; a response without an id is an error; and a recipient-patch failure deletes the orphaned draft.

Notes

Create a draft as a threaded reply via Graph createReply (keeping the
quoted original) and leave it in the Drafts folder for review instead
of sending. --to/--subject become optional: recipients default to the
original sender and are only overridden when supplied. Also adds
--cc/--bcc to drafts create. If setting recipients fails, the
half-built draft is deleted and the deletion outcome is reported so the
error never claims removal when the orphan remains.
@okuegow

okuegow commented Jun 29, 2026

Copy link
Copy Markdown
Author

Hi @visionik — hope you're well, and thanks for mog, it's become a daily driver for me.

I know mogcli is a side project, so no pressure, but I've got three small, self-contained, tested PRs sitting open that I'd love to get in:

All three are green and mergeable. Happy to squash them into a single PR if that's easier to review — just say the word.

And if it'd take maintenance off your plate: I'm glad to help co-maintain / triage the mog side. Either way, no rush — just flagging that they're ready whenever you have a minute. 🙏

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