If you are like me and don’t fuss about your email much but have a lot of newsletter subscriptions then you probably ran into this problem.
So if you are not feeling lucky (and don’t wanna buy additional storage) and have not organized your inbox much. Then you are in luck as I ran into this same problem and have created a simple script that should take care of those unwanted senders.
Link to script
To use the script you need to get your bearer auth token from google workspace
Log in to google workspace developer dashboard
Go to https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list
Copy bearer auth token from the list request headers, look for
https://content-gmail.googleapis.com/gmail/v1/users
in network tab.
Now assign this auth token here, update senders based on your requirements here. I have already added some based on my requirements.
All set you are ready to go, just type
touch text.txt
node delete_messages_from_senders.js
It will delete all the messages from listed senders and will update the text.txt
file with number of messages per sender.
Happy deleting emails!
Top comments (0)