Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

Gmail Batch Delete Helper

A small browser-console helper that repeats the Gmail workflow of selecting the conversations visible on the current page, moving them to Trash, waiting for Gmail to load the next page, and repeating.

No installation or browser extension is required.

Safety features

  • Shows a confirmation before deleting anything.
  • Processes only the conversations displayed on the current page, normally 50 at a time.
  • Does not click Gmail's Select all conversations link.
  • Stops if the Gmail view or search changes.
  • Refuses to run in Trash or Spam, where deletion could be permanent.
  • Stops if Gmail's Select or Delete controls cannot be identified unambiguously.
  • Supports a maximum batch limit and can be stopped with Escape or the Stop button.

Messages are moved to Trash; the script does not permanently erase them. Still, review your Gmail search carefully before starting.

Usage

  1. Open Gmail in Chrome.
  2. Run a search or open a category containing only conversations you intend to move to Trash.
  3. Open Chrome DevTools with F12 or Ctrl+Shift+I.
  4. Select the Console tab.
  5. Open gmail-batch-delete-helper.js, review it, and copy the entire file into the Console.
  6. Press Enter. A Gmail batch delete panel will appear in the lower-right corner.
  7. Set Maximum batches. One batch is normally 50 conversations.
  8. Click Start, review the confirmation carefully, and approve it.

Start with a maximum of 1 batch to verify the behavior with your Gmail layout before using a larger limit.

Stopping the helper

Press Escape, click Stop, or click × to remove the panel. The helper finishes any action already in progress and then stops.

You can also stop or remove it from the Console:

GmailBatchDeleteHelper.stop();GmailBatchDeleteHelper.destroy();

Troubleshooting

The panel does not appear

Confirm that you pasted the complete script into the Console while the active page was mail.google.com. Refresh Gmail and paste the script again if necessary.

Gmail selects conversations but does not delete them

Gmail occasionally changes its toolbar markup or event handling. Stop the helper, refresh Gmail, verify that you are using the latest version of the script, and test again with one batch.

The helper stops safely

Read the message shown in its panel. The helper intentionally stops rather than guessing when it cannot confirm a selection, deletion, or unchanged Gmail view.

Important notes

  • This project is not affiliated with or endorsed by Google.
  • Gmail's interface can change, so selectors that work today may need future updates.
  • The script operates in the currently signed-in Gmail account and current search or category. Verify both before starting.
  • Closing or refreshing the Gmail tab removes the helper.

About

Since you can't "Delete All" when using filtered email search on Gmail, here's a simple script to run in your browser console to automate email deletion.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages