title: How can I stop auto-replying to my email when using google-script?
body: <p>I have made a script to automatically reply when I'm outside of working hours.
  The sender receive one message from me, as expected. However, I am getting an email with the same content every minute, until I actually read the customer email.</p>
  <p>I do not want to mark the email as read until I actually read it.</p>
  <p>Is there a solution of stopping sending these emails?
  Thank you!</p>
  <p><a href="https://i.stack.imgur.com/ouRLs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ouRLs.png" alt="The inbox on my email" /></a></p>
  <p><a href="https://i.stack.imgur.com/HvL85.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HvL85.png" alt="The trigger configuration" /></a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function autoReply() {
  var interval = 5; // if the script runs every 5 minutes; change otherwise
  var wkday = [1,2,3,4,5,6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
  
    var wkMessage = "Buna ziua!\n\nMultumim pentru email!\n\nProgramul de lucru este de luni pana vineri, intre 8:00 - 16:30.\nIn fiecare luna, programul de lucru pentru ziua de vineri din prima si ultima saptamana este in intervalul orar 8:00 - 14:00.\n\nMultumim!"
    var progMessage= "Buna ziua!\n\nMultumim pentru email!\n\nVa vom raspunde imediat.\n\nMultumim!"
   
    var date = new Date();  
    var day = date.getDay();
    var hour = date.getHours();
    var minutes = date.getMinutes();
    if (wkday.indexOf(day) == 6 || wkday.indexOf(day) == 0 || (day == 5 &amp;&amp; hour &gt;= 14)) { 
      var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
      var threads = GmailApp.search('is:inbox after:' + timeFrom);
      for (var i = 0; i &lt; threads.length; i++) {
        threads[i].reply(wkMessage);
      }
    }
    else if (wkday.indexOf(day) &gt; 0 &amp;&amp; wkday.indexOf(day) &lt; 6 &amp;&amp; (hour &gt;=8 &amp;&amp; hour &lt;= 17)) { 
      var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
      var threads = GmailApp.search('is:inbox after:' + timeFrom);
      for (var i = 0; i &lt; threads.length; i++) {
        threads[i].reply(progMessage);
      }
    }
    else if (hour &lt; 8 || (hour &gt;= 16 &amp;&amp; minutes &gt;= 30)) {
      var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
      var threads = GmailApp.search('is:inbox after:' + timeFrom);
      for (var i = 0; i &lt; threads.length; i++) {
        threads[i].reply(wkMessage.bold());
      }
    }
    
  }
  function doGet() {
   return ContentService.createTextOutput("");
  }</code></pre>
  </div>
  </div>
  </p>