Created
October 10, 2013 11:34
-
-
Save esseti/6916967 to your computer and use it in GitHub Desktop.
BetterGmail experience
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This function archives all the read mail that are not in the inbox | |
function markArchivedAsRead() { | |
//i add "has:nouserlabels" beacuse i have filter that skip the emails form the inbox and place them in lables. for that case i want to keep the emails as unread. | |
var threads = GmailApp.search('label:unread has:nouserlabels -label:inbox'); | |
GmailApp.markThreadsRead(threads); | |
}; | |
//this funciton cleans the inbox | |
function cleanInbox() { | |
// for all the inbox mail that are not starred and are read, it archives them | |
var threads = GmailApp.getInboxThreads(); | |
for (var i = 0; i < threads.length; i++) { | |
var thread=threads[i]; | |
if (!thread.hasStarredMessages() && !thread.isUnread()) | |
GmailApp.moveThreadToArchive(threads[i]); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment