我需要按计划发送自动自动回复。答复中必须包含原始消息的内容。内容可以是纯文本。原始消息将包含需要包含在回复中的消息ID。
“电子邮件参考ID:[#a10-nb8w0sxgr#] _ [#c3602b001914be9b2ca21ceee87e114#]”
我需要将每封电子邮件的唯一文本包含在回复中
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();
var thread = GmailApp.getInboxThreads(0,1)[0]; // Get first thread in inbox
var message = thread.getMessages()[0]; // Get first message
Logger.log(message.getPlainBody()); // Log contents of the body
if ([6,0].indexOf(day) > -1 || //Saturday and Sunday
(day == 1 && hour < 8) || //Monday Morning
(day == 1 && hour >= 20) || // Monday Night
(day == 2 && hour < 8) || //Tuesday Morning
(day == 2 && hour >= 20) || // Tusday Night
(day == 3 && hour < 8) || //Wedneday Morning
(day == 3 && hour >= 20) || // Wednesday Night
(day == 4 && hour < 8) || //Thursday Morning
(day == 4 && hour >= 20) || // Thurday Night
(day == 5 && hour < 8) || //Friday Morning
(day == 5 && hour >= 20)) { // Friday Night
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("We would like to acknowledge that we have received your message.\n\nA support representative will be reviewing your request and will send you a personal response shortly.");
}
}
}