Skip to content

Instantly share code, notes, and snippets.

@nonsocchi
Last active May 2, 2022 19:53
Show Gist options
  • Save nonsocchi/85b6fc3707eb3d1045e7eb834ebb9578 to your computer and use it in GitHub Desktop.
Save nonsocchi/85b6fc3707eb3d1045e7eb834ebb9578 to your computer and use it in GitHub Desktop.
// FILTERING EMAILS...
function getBankEmails() {
// This function searches for messages from emails having subject containing
// “GeNS transaction Alert …”
var filter = "subject:GeNS transaction Alert";
var threads = GmailApp.search(filter, 0, 10);
var messages = [];
for (var x in threads) {
var thread = threads[x]
messages.push(thread.getMessages()[0]);
}
return messages;
}
function displayEmails() {
var templ = HtmlService.createTemplateFromFile('messages');
templ.messages = getBankEmails();
return templ.evaluate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment