Skip to content

Instantly share code, notes, and snippets.

@Edo78
Last active February 11, 2018 16:33
Show Gist options
  • Save Edo78/c9a78743424d0e9f96cc9cf329470ce0 to your computer and use it in GitHub Desktop.
Save Edo78/c9a78743424d0e9f96cc9cf329470ce0 to your computer and use it in GitHub Desktop.
A Google Apps Script that check how many unread spam are in your Gmail spam folder and log it to Stackdriver
function spamMonitor() {
var unreadSpam = GmailApp.getSpamUnreadCount();
var log = {
message: 'Discussioni non lette in Spam: '+ unreadSpam,
unreadSpam: unreadSpam
};
if(unreadSpam == 0){
console.info(log);
}else if(unreadSpam < 5){
console.warn(log);
}else{
console.error(log);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment