Here is a Google Script for using SaneBox alongside Unroll.me
I’ve written before about my drive towards living the Inbox Zero methodology and my experiment in reducing my emails by a quarter.
Two tools that I use to stem the tide of emails I receive are the excellent SaneBox and Unroll.me. Here’s a guide to using SaneBox alongside Unroll.me
SaneBox and Unroll.me
SaneBox is a fantastic tool that sits between my inbox and me and filters mail into various folders to help me to prioritise my email consumption. For instance, any email newsletters I receive are removed from my inbox and pushed into the @SaneNews sub-folder — so I can deal with them in batch and without them distracting from my important emails.
Unroll.me is another super free tool that captures any email newsletters I subscribe to and rolls them up into a daily digest. I can then scan read this digest at my leisure, rather than opening and closing each individual email newsletter.
Using SaneBox alongside Unroll.me is very useful to me.
Using SaneBox alongside Unroll.me
Unfortunately, SaneBox and Unroll.me don’t seem to play well together. SaneBox wants to move email newsletters to its @SaneNews folder, and Unroll.me wants to archive the messages in Google Mail. The end result is that I get both Unroll.me digest emails and (albeit marked as read) email newsletters in my @SaneNews folder.
It’s hardly the end of the world, but it is an irritation for me to have to select all the “read” email newsletters each day and manually remove the @SaneNews label in GMail.
Surely there is an automated way of doing this?
A Google Script to remove Unroll.me emails from @SaneNews
Thanks to a blog post by Fwed on Medium, and a Google Script by Amit Agarwal from StackOverflow that I’ve modified, there is.
Follow these steps to create a Google Script for your own Google Mail:-
- Visit script.google.com
- Copy and paste this code into your blank Google Script
function archiveYThreads() {
var label = GmailApp.getUserLabelByName(“@SaneNews”);
var threads = GmailApp.search(‘label:”Unroll.me”‘);
for (var i = 0; i < threads.length; i++) {
threads[i].removeLabel(label);
}
}
- Click File > Save
- Name it Gmail AutoArchive for Unroll.me (the script will be saved into the root folder of your Google Drive)
- Click the Run button
- Google Script will ask you for access to your Gmail. Allow this and proceed.
Give the script a few seconds to run, and you should notice that any emails in your @SaneNews folder that are labelled “Unroll.me” disappear — archived away.
Finally, to set this script to run automatically in the background:-
- Within your Google Script window, click on Resources > All your triggers
- Add a new trigger with the following settings: Time-driven, Minutes timer, Every 15 minutes.
Every 15 minutes, Google Script will scan your @SaneNews folder and if it finds any messages processed by Unroll.me, it will remove the @SaneNews label and archive the messages.
Conclusion
I’m absolutely no Google Script expert, and I created this script through simple trial and error using the work Fwed and Amit Agarwal provided as a basis. If anybody with more experience than me with Google Scripts would like to suggest any modifications or updates, please leave a comment below or get in touch with me. As it is, the script seems to work for me at least.
I hope any other SaneBox and Unroll.me users find this script useful!
Comments