Skip to content

Instantly share code, notes, and snippets.

Created August 11, 2020 11:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Lincest/d805959d31ffec77fc48a98510402bb7 to your computer and use it in GitHub Desktop.
function autoReplier() {
var labelObj = GmailApp.getUserLabelByName('autoreply');
var gmailThreads;
var messages;
var sender;
for (var gg = 0; gg < labelObj.getUnreadCount(); gg++) {
gmailThreads = labelObj.getThreads()[gg];
messages = gmailThreads.getMessages();
for (var ii = 0; ii < messages.length; ii++) {
if (messages[ii].isUnread()) {
msg = messages[ii].getPlainBody();
sender = messages[ii].getFrom();
MailApp.sendEmail(sender, "Auto Reply", "Hi, this is roccoshi, I've received your message and will give you reply later. Emergency contact :");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment