Summary
When creating a reply draft with gog gmail drafts create --reply-to-message-id <id>, the draft appears in the Gmail web UI thread (red "Draft" label visible) but cannot be opened or expanded. Clicking it does nothing.
Root Cause
fetchReplyInfo() correctly fetches the original message to extract the RFC 2822 Message-ID for In-Reply-To and References headers, and correctly sets threadId on the Draft resource. However, Subject is not fetched from the original message or auto-populated as Re: <original subject>.
Gmail's web UI requires subject matching (in addition to threadId and MIME headers) to render a draft as a proper reply in conversation view. When the subject doesn't match, the draft is filed into the thread (because threadId is set) but the UI can't expand it.
Expected Behavior
When --reply-to-message-id is provided and --subject is not provided, gog should:
- Fetch the original message's
Subject header (the message is already fetched in fetchReplyInfo)
- Auto-populate the draft subject as
Re: <original subject>, stripping any existing Re: prefix to avoid Re: Re: Re: chains
When --subject is provided with --reply-to-message-id, the current behavior (pass through verbatim) is fine, though a warning when it doesn't match the thread subject could help.
Reproduction
# Create a draft reply - draft appears in thread but can't be opened in Gmail web UI
gog gmail drafts create \
--account user@example.com \
--to "recipient@example.com" \
--subject "Re: Some Subject" \
--body "reply body" \
--reply-to-message-id <message-id>
Suggested Fix
In gmail_send.go, add "Subject" to replyInfoMetadataHeaders (around line 615). Then in gmail_drafts.go, when --reply-to-message-id is set and --subject is empty, populate it from the fetched metadata with Re: prefix.
Environment
- gog v0.11.0
- Gmail web UI (new interface)
- Tested on Linux (WSL2)
Summary
When creating a reply draft with
gog gmail drafts create --reply-to-message-id <id>, the draft appears in the Gmail web UI thread (red "Draft" label visible) but cannot be opened or expanded. Clicking it does nothing.Root Cause
fetchReplyInfo()correctly fetches the original message to extract the RFC 2822Message-IDforIn-Reply-ToandReferencesheaders, and correctly setsthreadIdon the Draft resource. However,Subjectis not fetched from the original message or auto-populated asRe: <original subject>.Gmail's web UI requires subject matching (in addition to
threadIdand MIME headers) to render a draft as a proper reply in conversation view. When the subject doesn't match, the draft is filed into the thread (becausethreadIdis set) but the UI can't expand it.Expected Behavior
When
--reply-to-message-idis provided and--subjectis not provided, gog should:Subjectheader (the message is already fetched infetchReplyInfo)Re: <original subject>, stripping any existingRe:prefix to avoidRe: Re: Re:chainsWhen
--subjectis provided with--reply-to-message-id, the current behavior (pass through verbatim) is fine, though a warning when it doesn't match the thread subject could help.Reproduction
Suggested Fix
In
gmail_send.go, add"Subject"toreplyInfoMetadataHeaders(around line 615). Then ingmail_drafts.go, when--reply-to-message-idis set and--subjectis empty, populate it from the fetched metadata withRe:prefix.Environment