Gmail – set Gmail “out of office” replies for every week recurring

gmail

I only work Monday through Wednesday. I would like to set it up so when clients email me on these days every week, they get a friendly reminder. How can I do this? It seem I would have to do it manually every week from the looks of it.

Best Answer

I adapted my answer to a similar question to your situation. This Apps Script will reply if the current day is one of Thursday (4), Friday (5), Saturday (6), or Sunday (0). The set of days can be adjusted as indicated below.

function autoReply() {
  var interval = 5;          //  if the script runs every 5 minutes; change otherwise
  var daysOff = [4,5,6,0];   // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
  var message = "This is my day off.";
  var date = new Date();
  var day = date.getDay();
  if (daysOff.indexOf(day) > -1) {
    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++) {
      threads[i].reply(message);
    }
  }
}