【发布时间】:2017-06-27 18:06:39
【问题描述】:
我已设置自动回复,以便任何在下班后发送电子邮件的人都会收到回复。我希望做的是能够排除具有特定主题或特定发件人的电子邮件,因为它们不需要回复。
这可能吗?还是我必须使用标签来实现这一点?请参阅下面的脚本。
function autoReply() {
var interval = 5;
var date = new Date();
var day = date.getDay();
var hour = date.getHours();
if ([6,0].indexOf(day) > -1 || (day == 1 && hour < 6) || (day == 1 && hour >= 19) || (day == 2 && hour < 6) || (day == 2 && hour >= 19) ||(day == 3 && hour < 6) || (day == 3 && hour >= 19) ||(day == 4 && hour < 6) || (day == 4 && hour >= 19) ||(day == 5 && hour < 6) || (day == 5 && hour >= 19)) {
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("Thank you for your email. We are currently outside our regular office hours of 6am to 7pm Pacific Time, Monday through Friday. We will respond to you once we are back in the office. \n\nIf you have already signed up for flight monitoring and need urgent assistance during those travels, please contact your assigned concierge directly and he or she will be able to help.");
threads[i].markRead();
threads[i].markImportant();
}
}
}
}
【问题讨论】: