Readit News logoReadit News
Posted by u/thefisola a year ago
Show HN: I made a Chrome extension to clean up your Gmail inbox locallyinboxpurge.com/...
Hi everyone,

My motivation for building this was to address the trouble of mass unsubscribing from unwanted emails and deleting bulk emails while ensuring privacy and control over the process. With this Chrome extension, emails are not sent to any external servers. All calls to the Gmail API happen locally on your device.

Feedback and suggestions are welcome!

lxe · a year ago
When you say "locally" it usually means it uses the browser's API to navigate the inbox and perform whatever actions necessary. This extension instead requires pretty intrusive permissions, just like the alternative competitors (which are under fire for selling your data).

I appreciate that you state that "data doesn't leave your device", but the whole point of "local" extension is that I don't have to take your word for it.

thefisola · a year ago
"Locally" here means, calls to the Gmail API are triggered directly from your browser(device) not on any third-party servers.

I totally understand your concern. Unfortunately, to perform those actions(unsubscribe/delete etc..) on your behalf while using the API, those "intrusive" permissions are required. If it wasn't needed, Google oauth verification team would not have approved.

I tried to explain the usage for each permission here: https://www.inboxpurge.com/permissions

saurik · a year ago
But if you are a browser extension I would have expected you wouldn't need your own permissions at all: you would either be scripting the UI of the client to accomplish your goals or stealing its authentication.
JZL003 · a year ago
I go through a lot of emails and what I love recently is being able to sort by sender - then all the emails from the same person are together and it's easier to skim through ("yup, all these are uneeded except this unusual one")

Annoyingly thunderbird allow but not gmail, so I wanted to use thunderbird. But it doesn't easily allow archive-ing, like GMail does.

Contrived but still easy solution: tag all your inbox you want to go through with two labels SetA and SetB. Open SetA in thunderbird, using `a` to remove emails from SetA as if you archived. Then in GMail, use the search `label:setB - label:SetA` and it gives all the emails you wanted to archive. Archive those and done

siscia · a year ago
If you go through a lot of emails, you may be interested in a small product I have developed.

GabrielAI (https://getgabrielai.com) can filter your emails given a GPT prompt and then make a special action, like drafting a reply or apply a label.

I am now introducing a digest if emails. So that every 6 hours (or whatever time) you receive an email with the summary of all the unread emails in your inbox.

It is free for now, but the summary feature is hide by a feature flag.

If you are interested, I can ungate your account.

compootr · a year ago
> GabrielAI will share data from Gmail with 3rd party AI model.

ah yes, since that's what I want all my communications fed through

aragonite · a year ago
I believe it's technically possible in Gmail by turning off conversation threading in the settings.

Unfortunately there doesn't seem to be any quick way of toggling between threaded and non-threaded.

trog · a year ago
In Thunderbird, can't you just move mail from Inbox to All Mail to archive? I don't use archive on my personal inbox in Gmail so not sure how it works.
alimbada · a year ago
I use a Google Apps Script to clean up my Gmail inbox. It runs daily, searches for various senders and/or subject lines which are older than a certain amount of time and moves them to the Trash/Bin. It runs without intervention and I've got it set up to report any failures back to my inbox. Since my workplace also uses Google I've even set up a Script for my work inbox on my work account. Various notification emails, e.g. from Slack get cleaned up if older than 3 days old.
palidanx · a year ago
I do something a little different, I tag all credit card payment notifications in a particular label, and wrote a google apps script where when a new entry is added, it adds it to my 'tasks'. That way I don't miss any credit card payments
oski · a year ago
Can you share the code for this?
alimbada · a year ago
Done: https://gist.github.com/alimbada/5bc5878338ead31b6308ac9fd74...

The queries are the same as what you'd type into the Gmail search bar to filter emails so you can test them out in Gmail and then add them to the list. I've added a comment to the gist with an image showing the trigger to run it daily. You can run it manually from the Google Script editor too for testing.

Edit: Forgot to mention I removed a bunch of queries and only left a few in as examples.

kleiba · a year ago
I recently made my first Firefox extension and was surprised how simple it actually was (just for personal use: I had to repeatedly copy lots of data which I already had in a spread sheet into a web form - the extension lets you copy a whole row of data from the sheet and paste in into consecutive form fields on the website). As usual, it's not clear whether it was actually less work to develop the extension than it would have been to just manually put in all the data, but it was definitely better for my mental health.

Perhaps I will look into developing more serious extensions in the future, it was actually a quite pleasant experience.

Is it fair to say that developing extensions for Chrome is comparable?

insin · a year ago
For extensions which primarily add functionality to a target site, you can usually run the exact same extension code in Chrome, Firefox and Safari.

The latter two have API differences from Chrome - e.g. using the `browser` namespace for extension APIs instead of `chrome`, and Promises instead of callbacks for async functionality - but for the sake of compatibility they also implement Chrome's version of these APIs [1][2], so if you just use the Chrome APIs and don't venture into the more browser-internal APIs such as bookmarks, the same extension code will likely run everywhere, with some specific differences/incompatibilities noted in the docs below.

If you were to create a new cross-browser extension today, one of the main issues would be that Chrome Web Store no longer accepts new MV2 extensions so you have to use MV3 for it, but MV3 in Firefox currently has some serious usability issues around permissions which are being addressed in upcoming releases [3] so you'll want to use MV2 for it, however this likely just means you'd need to have separate MV2 and MV3 manifest.json files which get bundled into different zip files for submission to the different browser extension stores. I had to do this recently for one of my extensions [4]

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...

[2] https://developer.apple.com/documentation/safariservices/saf...

[3] https://blog.mozilla.org/addons/2024/05/14/manifest-v3-updat...

[4] https://github.com/insin/control-panel-for-twitter/commit/59...

thefisola · a year ago
Cool!

Yes it's pretty similar. There just some minor API differences. e.g

Chrome - chrome.tabs.query(queryInfo) Firefox - browser.tabs.query(queryInfo)

So you could easily port any firefox extension to chrome and vice-versa using the same codebase.

kleiba · a year ago
Oh, it's that similar? That's actually really cool then.
jokoon · a year ago
I would rather be able to see statistics about the domains of the email I receive instead, to see offenders etc. I already created a lot of filters for that, which helps a lot do some cleanup.

Also, I seem to have a lot of attachments, like a lot, and I can't clean them up, because gmail doesn't let me see the datasize clearly.

I downloaded my mail as an export, I think EML, I wanted to build a mail list myself to see attachments with a python script, but I think gmail doesn't export all the metadata of how mail are chained with each other and such.

Unfortunately, I think your extension cannot really do statistics on an existing mailbox, to see a map of mail counts per domain.

thefisola · a year ago
At the moment the extension's side bar shows mail count per sender, not domain. You can also order from highest to lowest. Does that suffice for you?

You're right Gmail does not show the datasize clearly, but to get emails with large attachments, you can use search filters like: "larger:15M", where 15M is 15 megabytes. It's not exactly what you want but might help

siscia · a year ago
Gmail API gives you the email file as MIME file.

From there is a bit up to you and depending on actually what data you get.

But I had a reasonable simple time with parsing it and getting data out of it while building https://getgabrielai.com

JoBrad · a year ago
That reminds me of xobni, which MS acquired years ago. It was pretty awesome, when it first came out.
hansoolo · a year ago
Funny! I am working on something similar for myself. But not restricted to just Gmail. I really want to clean up this mess in my accounts.

How did you go about the unsubscribe functionality? Also, I think I saw that Gmail has that feature themselves now.

thefisola · a year ago
Oh that's cool!

As at Febuary, Gmail introduced new guidelines for bulk email senders to make it easy unsubscribe from by adding a value for "List-Unsubscribe"

https://support.google.com/a/answer/81126?hl=en&visit_id=638...

So unsubscribing is simply a POST request to the value of this email header (List-Unsubscribe) - which is a link and comes as part of the email headers in the Gmail API response

The alternative approach is to parse the content of the email and use regex to get the unsubscribe link using the likely words. e.g links with words like: unsubscribe, opt-out etc..

Yes, Gmail has the unsubscribe functionality. Unfortunately, you cannot mass unsubscribe. If you have over 100 unwanted subscriptions you would have to unsubscribe from each one at a time.

Hope that helps you

hansoolo · a year ago
>Yes, Gmail has the unsubscribe functionality. Unfortunately, you cannot mass unsubscribe. If you have over 100 unwanted subscriptions you would have to unsubscribe from each one at a time.

That is a valuable info. Thank you!

>The alternative approach is to parse the content of the email and use regex to get the unsubscribe link using the likely words. e.g links with words like: unsubscribe, opt-out etc..

That's how I started to implement it. But then again you will need to go through every unsubscribing process manually...

Best of luck with your extension!

maxcan · a year ago
Is yours open source? I'd be interested in contributing.

I'm just very wary of giving closed source extensions "the keys to the kingdom" and complete access to all of my eamil.

netsharc · a year ago
I don't get it...

> With this Chrome extension, emails are not sent to any external servers.

Don't you have to send an "Unsubscribe" email? To an external server?

> All calls to the Gmail API happen locally on your device.

Aha, you mean in comparison to a "SaaS" where these things happen on a third party server...

thefisola · a year ago
I assume you've answered your question but just to explain further:

So generally in order to actually help you mass unsubscribe from unwanted emails, most email cleaning tools handle your email data on their server. The process of parsing email data to fetching unsubscribe links or unsubscribe instructions etc..

So there's a trust problem where some tools have been caught selling user data: https://www.nytimes.com/2017/04/24/technology/personal-data-...

So the goal here with InboxPurge is to move all these processes related to your email data to your device(browser), ensuring your privacy.

philsnow · a year ago
In another post, you mention that there’s a header that can include an https link to POST a request to unsubscribe. So this extension and anything like it must be able to read email and send POSTs to arbitrary endpoints[0].

> ensuring your privacy

But only if we trust the extension author (and the authors of all of the transitive dependencies) to be neither malicious nor incompetent… right? I don’t know of resources that explain exactly what actions each permission in the manifest grants the extension to perform, nor a characterization of the execution environment of extensions. Do all browsers handle these matters similarly? Does some browser provide any more isolation or sandboxing than any other?

Edit: by no means did I mean to throw shade or cast doubt on your extension, I’m just grumpy in general and in particular about browser extensions, since nowadays “the browser is the OS”.

[0] or maybe there’s a gmail api that does it for you, and this extension actually can’t make arbitrary http connections?

birdman3131 · a year ago
So this give very little info on how the bulk email deletion works.

For instance at last look I had north of 40k emails from ebay. I can't just delete them all as I want to keep anything that is related to either an order I placed or an item I sold. I have went back 15+ years before to find part numbers before.

But I have no interest in the 38000+ marketing emails from them. (I kinda wanna keep getting them but don't want them a week after I get them.

And if I recall correctly the emails have often come from the same accounts so I can't even filter by that.

siscia · a year ago
Would you pay for that?

I developed GabrielAI (https://getgabrielai.com) an assistant for Gmail.

You provide a GPT prompt and it scan all the new emails. If the email matches the prompt it will do an action. Either drafting a reply for you or set a label.

It will be trivial to go through the whole inbox. But expensive.

It is a nice feature to add though...

kaanyalova · a year ago
You can use a Google Apps Script for that, similar to what this guy did

https://news.ycombinator.com/item?id=40373060