Skip to content

Feature: trash-all / bulk trash by query (e.g. gog gmail trash-all "from:x") #459

@stephenandrew16

Description

@stephenandrew16

Problem

When deleting large volumes of emails from a sender, the current workflow requires:

  1. gog gmail msgs list "from:x" --all to collect IDs
  2. A loop of gog gmail trash <id> calls — one per message

With 400+ emails, this triggers Gmail API rate limits (403 rateLimitExceeded), requiring throttling to ~1 req/sec and taking 7+ minutes.

Workaround Discovered

gog gmail batch modify --add TRASH --remove INBOX <ids...> works and handles hundreds of IDs in a single API call. But it requires a two-step list-then-batch pipeline.

Feature Request

Add a trash-all (or trash --query) command that combines search + batch modify in one step:

gog gmail trash-all "from:thrivemarket.com" --account user@gmail.com
# or
gog gmail trash --query "from:thrivemarket.com" --all --account user@gmail.com

This would internally:

  1. Paginate through all matching message IDs
  2. Batch-modify them (add TRASH, remove INBOX) in chunks of 100–1000

Why not batch delete?

gog gmail batch delete requires the https://mail.google.com/ scope which many users won't have granted. Batch modify with the TRASH label works with the standard gmail.modify scope.

Impact

Makes bulk inbox cleanup (unsubscribe + delete workflows) fast and ergonomic instead of requiring scripted workarounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions