Skip to content

feat: add --quote flag to include original message in replies#169

Open
terry-li-hm wants to merge 7 commits intosteipete:mainfrom
terry-li-hm:feat/quote-original-message
Open

feat: add --quote flag to include original message in replies#169
terry-li-hm wants to merge 7 commits intosteipete:mainfrom
terry-li-hm:feat/quote-original-message

Conversation

@terry-li-hm
Copy link

@terry-li-hm terry-li-hm commented Feb 3, 2026

Adds a --quote flag to gog gmail send that automatically quotes the original message when replying, with proper Gmail rendering.

Features

  • Plain text quote: Adds > prefixed lines for plain text email clients
  • HTML blockquote: Generates proper Gmail-style <blockquote> with blue left border
  • Preserves formatting: Original email's HTML formatting (links, bold, images) is preserved in the quote
  • Attribution line: "On , wrote:" header above the quote

Usage

gog gmail send \
  --reply-to-message-id=<id> \
  --quote \
  --to=someone@example.com \
  --subject="Re: Topic" \
  --body="My reply here"

How it works

  1. Fetches original message with full body (both plain text and HTML)
  2. Appends plain text quote with > prefix to --body
  3. Generates HTML with user's body + <blockquote> containing original HTML
  4. Gmail renders the HTML version with proper quote styling

Changes

  • Added --quote flag to GmailSendCmd struct
  • Extended replyInfo to include BodyHTML for preserving original formatting
  • Modified fetchReplyInfo to fetch full message body when quoting
  • Added formatQuotedMessage() for plain text quotes
  • Added formatQuotedMessageHTML() and formatQuotedMessageHTMLWithContent() for HTML quotes
  • Auto-generates HTML body when --quote is used (even without --body-html)

Testing

  • go test ./internal/cmd/... -run 'Send|Reply' - all tests pass
  • Manually tested with real Gmail - quote renders with blue left border and preserved formatting

OpenCode added 7 commits February 3, 2026 16:16
Adds a --quote flag to gog gmail send that automatically quotes the original message when replying.

Changes:
- Added --quote flag to GmailSendCmd struct
- Modified fetchReplyInfo to optionally fetch message body
- Added formatQuotedMessage function for attribution and quoting
- Updated validation to require reply target when --quote is used
Add automatic message quoting when replying to emails. The new --quote flag
includes the original message body with proper attribution line and quote
prefixes when using --reply-to-message-id or --thread-id.

Changes:
- Add Quote bool flag to GmailSendCmd struct
- Validate --quote requires reply target (--reply-to-message-id or --thread-id)
- Modify fetchReplyInfo to support fetching full message format for quoting
- Add Date and Body fields to replyInfo struct
- Add formatQuotedMessage function to format original message as quote
- Append quoted message to user's body when --quote is set
- Update test calls to replyInfoFromMessage with new includeBody parameter
- Use gmailFormatFull/gmailFormatMetadata constants instead of string literals
- Use body += for appending instead of body = body +
- Quote now works when original message has only HTML content (no plain text body)
- Removed unused formatQuotedMessageHTML function

Fixes edge cases where --quote would skip messages with HTML-only bodies.
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