noReply mail with apps script should ignore already replied mailadresses

Viewed 19

whats up :D

I hav set up a very, very eased up noreply mailresponder.

UseCase:

We send some kind of notification via Email from our service (Like: "Hey, check out new message") But the receiver of that mailnotification should not respond to our email notification.

If he still does we have set up an email auto responder -> curently what i have done with apps scripts on google is following:

function AutoResponder() {

  var query = "is:unread" ;
  var unread = GmailApp.search(query);



  for (var i in unread)
   {

    var thread = unread[i];
    var messages = thread.getMessages();


    if (messages.length === 1) { // the reply


       body =  

              "<p> Blabla dont reply to our email thx </p>"

       options = 

       {

         name: "This is the subject of mail",
         htmlBody: body
         
       };


       thread.reply("", options);
    }
  }
}

Ive set a trigger like every 15 mins the code will get excecuted.

Works quite well but i have an issue:

When recipient has set an autoresponder aswell, they keep looping (sending each other this autoresponder mail) until i delete the last email of that user, so script wont be able to see that thread in the google message list screen.

But i would like to implement that in the code, somehow try to cache the sendermail and not send an response for few hours.

Is that somehow possible?

Thank you guys in advance and have a nice week guys!!

0 Answers
Related