I am using the following script from Any way to send Gmail auto-response at certain times every week?. It does not send the expected email.
function autoReply() {var interval = 5; // if the script runs every 5 minutes; change otherwise var date = new Date(); var day = date.getDay(); var hour = date.getHours(); if ([5,6,0].indexOf(day) > -1 || (day == 1 && hour < 8) || (day == 4 && hour >= 17)) { var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval; var threads = GmailApp.search('is:inbox after:'+ timeFrom); for (var i = 0; i < threads.length; i++) { if (threads[i].isUnread()){ threads[i].reply("I am out of office. Your email will not seen until Monday morning."); threads[i].markRead(); threads[i].markImportant(); } } }}To test the script I sent emails from another address. I've tested many times with clicking run both before and after the emails were received. I don't believe that should make a difference because the script should run again after the specified interval.
The Execution log shows that the script completes immediately after it starts.