Automating unsubscribe in gmail with total privacy

Sam Collins June 20, 2020

I was looking for tools to add automation to my inbox to help manage email. The need driving me at first was to find something to help automate how I can unsubscribe from emails I'm not engaging with. Surprisingly, I couldn't find any tools that did the job I was looking for.

The job I want done

There is a significant volume of email I don't want to receive. I manage my inbox on a daily basis like most people, but if I disconnect from the internet and come back after 7 days - I notice that I discard a majority of the email that's built up. Perhaps more than half of the unread emails, I select all and archive without reading. It seems I can more easily see with some distance what is not worth it, versus in the thick of my daily grind.

So, the job I want done is some form of auto-unsubscribe. I want software to help spring clean my inbox, and reduce how much I need to process on any given day. If it was easier and more automatic to spring clean, I might do it every Sunday for example, and not just the few times when I disconnect from my inbox for an extended break.

How this job must be done

I would often default to "however software can best do it", but this is a special case. My inbox is one of the most personal/sensitive/valuable digital assets I have -- I operate my inbox today with the idea that I'm the only one with access to it. I allow secrets of varying degrees of sensitivity to be stored there. It allows me to regain access when I've lost a username or password for another account.

And so I don't feel even remotely comfortable letting any developers' code run here. I also absolutely don't want my email data being stored on third party servers here and there. The lingering fear that this information could be read by others, or that such a server could be compromised and my information could leak - oof, makes me cringe. Any risk here at all gives rise to an anxiety inside me that makes the net benefit of automation not worth it; I'd feel better overall being slower and clicking buttons.

So if it's not too much to ask, all I want is software to help me unsubscribe from email I don't want, with zero privacy or security risk.

Why build something

After looking at and considering the alternatives I could find, I decided to write some code myself and build at least a basic prototype of what I had in mind. There were a few reasons for that decision:

  • Given how we all struggle with email, it surprised me there weren't more existing solutions meeting my needs. It wasn't immediately obvious why that was. Was my ask not technically (or practically) viable? Was it just not a profitable approach compared to the alternatives? Neither were obviously true.
  • Naturally I trust code I write and control more than the third party code I can't see. So if this become technically impossible, I could still salvage a black box solution that just I could use. However I set out to build the product I wanted assuming I wasn't the author of the code. If I could solve the problem that way, then this could probably help others too.
  • If it demonstrated potential, it might encourage others to build automation for other use cases in a similar way (I would pay for more tools like this!)

Principles and Ideas

This is still early stage so these principles and their definitions may refine over time, but in their current form they can give you a high level idea of the direction I have in mind as I explore this.

  1. A digital helper for my digital space. I have a fairly vivid mental model of a little robot that works for me, like a Roomba in my closet. I want to turn it on and it'll go around cleaning up for me. Perhaps in this case a better mental analogy is an outsourced human assistant who is amazingly diligent, follows my instructions precisely, but doesn't bill per hour (or ever!). I'll keep refining this as I work through some prototypes.

  2. Work for me, not someone else. My robot should always to serve my needs, and not have some conflicting or ulterior motivations. The main characteristic of "writing my own code" versus using someone elses code (in a browser extension/app, etc) is it directly solves the principal-agent problem: there is absolutely no reason that my code is motivated to do anything other than serve my specific needs. I really want to retain this characteristic. For comparison, Unroll.me, which is an email unsubscribe tool that also scans your inbox for retail intelligence for Rakuten is an example of not being primarily motivated to serve my needs.

  3. Don't dimish my control, supplement it. Like a Roomba, there's a hard switch to turn it off. At worst, I can grab it if it's about to fly off the stairs. Bugs and automation aren't an amazing duo. I don't want to regret ever turning this on and finding my inbox ripped to shreds some day.

  4. Confirm value through payment. I plan to make some part of the tool require a small one-time payment or subscription so I could better understand if people were really willing to open their wallets for robots like this. Since following these principles meant I could collect no product analytics on usage, this would also help confirm how much it's solving other people's problems.

  5. Be genuinely transparent. The code should be open source, and it should be easy to verify the code that's running in my inbox is that same open source code. It means you don't need to trust what I say here. You can! But you don't have to :)

Introducing Unsubmarine

As far as I can see, addressing the fundamental question around privacy and achieving zero risk requires not having a server at all (a new meaning for serverless!) - which really constrains the product approaches. Hence I chose an approach of browser automation so I could automate repetitive actions I would myself in the inbox. It's like Puppetteer - or browser automation - for Gmail. I'm doing pretty well against my fundamentals:

  • No data leaves your inbox (runs entirely client side; no server involved)
  • Let me be in control (let user decides which unsubscribe links to action)
  • Open Source (Unsubmarine repo on GitHub)
  • Validate extension code is the GitHub code (TODO)
  • Offer a paid version/feature (TODO)

(Ideas welcome on the todos.)

Unsubmarine is a Chrome extension that runs entirely inside Gmail so no data ever leaves your inbox. It automates clicking through a list of emails, to build up a list of unsubscribe links for you to action all at once. It's an experiment in automation and privacy.

Try it out

  1. Install the Unsubmarine extension for Chrome
  2. Launch gmail in Chrome
  3. Click the Unsubmarine extension icon to run

Code is open source on Github if you want to inspect before installing the extension (I'm still thinking how to best prove that this is the code inside the extension on the Chrome webstore - you can build from the source and install the extension locally if you need this for now).

Check out the initial prototype (for posterity)

I'm publishing the first prototype toofor any interested nerds and to remind myself what I started with. It's not pretty of course but a pragmatic prototype that was running in the first hour or two. If you're interested in what the v1 looked like, here it is.

Let me know what you think

Because of the above principle of no data leaving your browser, it's not possible to have even basic analytics running to tell me if it's working well for you or not. Let me know on twitter at @smcllns or over email at oscollins@gmail.com if you have any feedback to share with me.