これをしばらく使用した後、他にいくつか見ておきたい点や改善点があります。
function autoReply() {
var interval = 5; // if the script runs every 5 minutes; change otherwise
var daysOff = [1,5,6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
var date = new Date();
var day = date.getDay();
var label = GmailApp.getUserLabelByName("autoresponded");
if (daysOff.indexOf(day) > -1) {
var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
var threads = GmailApp.search('is:inbox !label:autoresponded after:' + timeFrom);
for (var i = 0; i < threads.length; i++) {
var message = threads[i].getMessages()[0];
if (message.getFrom().indexOf("myemail@gmail.com") < 0 && message.getFrom().indexOf("no-repl") < 0 && message.getFrom().indexOf("bounce") < 0 && message.getFrom().indexOf("spam") < 0) {
threads[i].reply("", {
htmlBody: "<p>Thank you for your message. I am not in the office today. If you have urgent questions you can email office@example.com. If you have other urgent enquiries you can call the office on 1800 999 002.</p><p>Best regards,<br>Name</p>"
});
label.addToThread(threads[i]);
}
}
}
}