One can include an HTML message in reply by using the reply(body, options)
syntax, instead of the reply(body)
syntax used above. Plain text body must still be provided for those clients who do not render HTML in messages.
The relevant parts are
var message = "This is my day off.";
var htmlMessage = "This is <strong>my day off</strong>.";
// later
threads[i].reply(message, {htmlBody: htmlMessage});
The complete script becomes
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 htmlMessage = "This is <strong>my day off</strong>.";
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, {htmlBody: htmlMessage});
}
}
}