Skip to main contentdfsdf

  • Sep 26, 11

    Introductory webinar presentation coving JavaScript

  • What is Gmail Snooze?

    One feature that some of us really wanted was for Gmail to let you “snooze” an email. Snoozing means archiving an email for now, but having it automatically reappear in the inbox at some specified time in the future. With Apps Script you can extend Gmail to add this functionality and a lot more yourself.

    How to set it up

    Even if you don't know how to write a script, it's pretty simple. Go to Google Docs and create a new spreadsheet, then choose "Script Editor" from the "Tools" menu. Paste in 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


    for (var i = 1; i <= 7; ++i) {







    function moveSnoozes() {

    var oldLabel, newLabel, page;

    for (var i = 1; i <= 7; ++i) {

    newLabel = oldLabel;

    oldLabel = GmailApp.getUserLabelByName(getLabelName(i));

    page = null;

    // Get threads in "pages" of 100 at a time

    while(!page || page.length == 100) {

    page = oldLabel.getThreads(0, 100);

    if (page.length > 0) {

    if (newLabel) {

    // Move the threads into "today’s" label


    } else {

    // Unless it’s time to unsnooze it


    if (MARK_UNREAD) {








    // Move the threads out of "yesterday’s" label






    Then click the “Save” button and give it a name. In the dropdown labeled "Select a function to run," choose "setup" and click the blue run arrow to the left of it. This will ask you to authorize the script, and will create the necessary labels in your Gmail. Then go to the "Triggers" menu and choose "current script's triggers." Click the link to set up a new trigger, choosing the "moveSnoozes" function, a "time-driven" event, "day timer," and then "midnight to 1am." Click save and you’re done.

    Using the Snooze Label in Gmail

    To "snooze" a thread, use Gmail’s “Move To” button to move the thread into the "Snooze for X days" label and archive it. Every night, threads will move up through one day of the queue, and at the appointed number of days they will reappear in your inbox, unarchived.

    Because this is an Apps Script, you can edit the code any way you like. If you’d like different snooze times or for unsnoozed messages to get starred, you can easily change the code. And if you have an even better idea for how to use Apps Script to improve Gmail, you can post it to our Gallery (Script Editor > Share > Publish Project) to share with the world.

    • Yet another way to keep email organized. Very easy to set up, and works slick. - Rob Reynolds on 2011-07-31
  • Apr 14, 11

    Easy to use Apps scripting for creating self-grading quizzes using Google forms. 

    This will rock your world.  Check it out!!

  • Feb 05, 11

    Slide to go along with webinar on advanced forms.  Great example of self-grading tests using templates

1 - 7 of 7
20 items/page
List Comments (0)