Automating unsubscribe for gmail

Sam Collins August 28th, 2020

A feature I would love from gmail is a way to query my inbox for emails I can unsubscribe from and controls to batch unsubscribe from them. Something as basic as this would be a great start:

Screenshot of an unsubscribe query

The problem with all the available solutions is they either don't provide a way to efficiently batch unsubscribe from emails, or they require granting pretty wide access to my email inbox—a privacy threshold I just can't get comfortable with.

Making a solution that strictly preserves privacy and control

This got me thinking about the types of solution that might work. My litmus test was to find a solution I would be willing to run in my inbox if I wasn't the author of the code. How could the design enable certain privacy and security commitments such that I'd feel comfortable running the code in my inbox?

One possibility—which could achieve such privacy but would also significantly constrain its potential functionality and user experience—would be to remove the server entirely. The code would need to run purely locally inside my browser. This would mean no data would need to leave the client, no data would be stored on remote servers, and there would be no way for the author or anyone else to access my inbox data.

Introducing Unsubmarine

So here's a proof of concept. It's runs 100% locally and works like a little scraper or personal bot for your gmail inbox. It clicks through emails on your behalf, doing a basic text search in each email for unsubscribe links, then presents all unsubscribe links for you to batch action in one go.


Unsubmarine is a Chrome extension that automates looping through emails to build up a list of unsubscribe links, and then gives you a batch unsubscribe option for your gmail. It runs entirely in the client so your data never leaves your browser.

Try it yourself

  1. Install Unsubmarine chrome extension
  2. Launch gmail in Chrome desktop
  3. Click the Unsubmarine extension to activate


Would love any feedback after you tried it, or if you have reservations stopping you trying it! Feature requests/bugs on github issue tracker and for any feedback/discussion, email me: oscollins@gmail.com or DM on twitter: @smcllns

All code is open source on github: https://github.com/smcllns/unsubmarine

Known limitations

  1. Chrome only. Very little code is chrome-specific so easy to extend to Firefox if needed. The first version of this was just some hacky scripts that ran in browser console, so you can run that version in Firefox this way if you wish.
  2. Desktop browser only. Easiest to hack the privacy centric prototype. Also not sure this use case needs to be mobile -- how often do you need to batch unsubscribe/clean up your inbox?
  3. Limited to finding 10 unsubscribe links. This is an arbitrary limit and can change, but I'm thinking to make it cost a one-time $1 fee to remove this limitation as a way to confirm people are getting value from it?