March 2016
Beginner to intermediate
232 pages
4h 29m
English
The forwardEmails function is able to forward e-mail messages, if a specific keyword is found in the body text to a prefixed e-mail ID. Be cautious about the number of iterations of the for loop while testing your code so that you can avoid lot of messages forwarded in error:
/** * 1. Checks all unread inbox threads and messages. * * 2. If specific keyword found then forwards it to another * recipient. * * 3. Marks that message as Read. * */ function forwardEmails() { var recipient = "[[forward email id]]"; /* * Use keywords separated by '|'. * For example: "purchase | invoice" * */ var words = "keywords list"; var regExp = new RegExp(words,'g'); var len = GmailApp.getInboxUnreadCount(); ...Read now
Unlock full access