How to Snooze Gmail using Google Script
There is no need to introduce Gmail as all of the people may know how popular it is and how useful it is. People use Gmail as this is one of the best easiest things to use on the planet. The most popular reason is Gmail is completely free and you can synchronize your Google services with the help of Gmail.
Gmail comes with a lot of useful features those are often used by almost all the Gmail users. Although, Gmail has so many features, but it is lacking of some features those are generally available in another Gmail client called Inbox by Gmail. Among all the new features of Inbox by Gmail, snooze is the most popular thing, what is being used by millions of people.
Sometime, we do not reply to an important email because we need to think before replying. Sometime, we do not want to reply to an email. These things happen very often. And we forget to reply to most of the email after keeping them in READ folder. If you have marked an email as Read, there is a high chance to forget about it later. Hence, a Snooze option is always awesome to have that will help you to keep that email in mind at a certain time.
But, unfortunately, Gmail has no such feature. Although, Inbox has the option to snooze email, but Gmail doesn’t come with such feature. Therefore, here is a trick that will help you to snooze Gmail. Today, we are about to use Google Script, which is quite geeky but very useful once you finished the setup. You do not have to write any code but you will have to work with some lines of code.
Snooze Gmail using Google Script
This is very easy and not much time consuming. At first, open Google Scripts and paste the following code. Alternatively, you can open Google Sheet >> Tools >> Google Script. It will do the same. Now, remove all the three lines of code that generally appear after creating a new Google Script. After that, paste the following code,
var MARK_UNREAD = false; var ADD_UNSNOOZED_LABEL = false; function getLabelName(i) { return "Snooze/Snooze " + i + " days"; } function setup() { // Create the labels we'll need for snoozing GmailApp.createLabel("Snooze"); for (var i = 1; i <= 7; ++i) { GmailApp.createLabel(getLabelName(i)); } if (ADD_UNSNOOZED_LABEL) { GmailApp.createLabel("Unsnoozed"); } } function moveSnoozes() { var oldLabel, newLabel, page; for (var i = 1; i <= 7; ++i) { newLabel = oldLabel; oldLabel = GmailApp.getUserLabelByName(getLabelName(i)); page = null; while(!page || page.length == 100) { page = oldLabel.getThreads(0, 100); if (page.length > 0) { if (newLabel) { // Move the threads into "today's" label newLabel.addToThreads(page); } else { // Unless it's time to unsnooze it GmailApp.moveThreadsToInbox(page); if (MARK_UNREAD) { GmailApp.markThreadsUnread(page); } if (ADD_UNSNOOZED_LABEL) { GmailApp.getUserLabelByName("Unsnoozed") .addToThreads(page); } } // Move the threads out of "yesterday's" label oldLabel.removeFromThreads(page); } } } }
Now give it a name and save the script. There is no need to play with this code. Instead, you can just save it after giving it a name. Following that, click on the drop-down menu that comes next to the Debug button and select Setup.
After that, click on the play/run button. It will require your authorization. Give it and authorize the script to run in the background of your Gmail account.
Now, you have to setup a Time-driven trigger so that Google Script can run this code once a day. You do not have to run the code manually and this is why you have to create a trigger. To do so, click on Resources >> Current project’s triggers. Create a new trigger and set it up like this,
Run: moveSnoozzes
Events: Time-driven >> Day Timer >> midnight to 1:00 a.m.
That’s it! Now, you can find a Snooze label in your Gmail account. Apart from that, you will get more other sub-levels. Whenever, you want to snooze an email, you just need to put that email in that label/folder. That will be all.