Skip to content

feat(gmail): add --body-format flag to messages search#520

Open
alexknowshtml wants to merge 2 commits intosteipete:mainfrom
alexknowshtml:feat/gmail-body-format
Open

feat(gmail): add --body-format flag to messages search#520
alexknowshtml wants to merge 2 commits intosteipete:mainfrom
alexknowshtml:feat/gmail-body-format

Conversation

@alexknowshtml
Copy link
Copy Markdown
Contributor

Summary

Adds --body-format to gmail messages search for controlling which MIME part is returned when --include-body is used.

  • --body-format text (default) — preserves existing behavior, returns plain text part (falls back to HTML if no plain text)
  • --body-format html — prefers the HTML part (falls back to plain text if no HTML)

Adds bestBodyHTML() helper to complement bestBodyText().

Motivation

Newsletters and rich emails often have a minimal plain text part (or just "view in browser") while all meaningful content is in the HTML part. This flag makes it possible to retrieve that content without custom workarounds.

Usage

gog gmail messages search "from:newsletter@example.com" --include-body --body-format html

Test plan

  • --body-format text returns existing behavior (plain text, HTML fallback)
  • --body-format html returns HTML part when present
  • --body-format html falls back to plain text when no HTML part exists
  • Omitting --body-format defaults to text behavior
  • Invalid value is rejected by kong enum validation

🤖 Generated with Claude Code

alexknowshtml and others added 2 commits April 21, 2026 22:00
Supports "text" (default, existing behavior) and "html" to prefer
the HTML MIME part over plaintext. Useful for newsletter ingestion
where the HTML body contains the rich formatted content.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Unintended commit
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