我正在尝试制作我自己的 Boomerang 版本,这是一个脚本,可以在用户指定的稍后时间将电子邮件返回到您的收件箱。
我正在使用 Google Apps 脚本,除了无法将电子邮件返回到收件箱顶部外,一切正常。我尝试使用相关脚本转发电子邮件,但无济于事。
有什么想法吗?
这是我尝试过的代码的一些示例(没有一个产生我正在寻找的结果):
测试1:
messages = GmailApp.getMessagesForThreads(threads);
for (var i = 0 ; i < threads.length; i++) {
messages[i][0].reply("<b>This message has been moved to the top of your inbox per your request. Please take action soon.</b>", {
replyTo: "desiredEmail@gmail.com"
});
}
测试 2:
messages = GmailApp.getMessagesForThreads(threads);
for (var i = 0 ; i < threads.length; i++) {
forward("desiredEmail@gmail.com", {
htmlBody: "<b>This message has been moved to the top of your inbox per your request. Please take action soon.</b>",
name: "ServAce85",
replyTo: "desiredEmail@gmail.com",
from: "desiredEmail@gmail.com",
subject: "Re: " + messages[i].getSubject()
});
}
测试 3:
messages = GmailApp.getMessagesForThreads(threads);
for (var i = 0 ; i < threads.length; i++) {
messages[i][0].forward("desiredEmail@gmail.com", {
subject: messages[i][0].getSubject()
});
}
测试 4:
function moveEmail(threadsToMove) {
var threads = threadsToMove;
var messages = GmailApp.getMessagesForThreads(threads);
for (var i = 0 ; i < threads.length; i++) {
messages[i][0].forward(Session.getActiveUser().getEmail(), {
subject: "Re: " + messages[i][0].getSubject(),
htmlBody: "<b>This message has been moved to the top of your inbox per your request. Please take action soon.</b></n>" + Session.getActiveUser().getEmail() + "</n>" + messages[i][0].getBody()
});
GmailApp.sendEmail(Session.getActiveUser().getEmail(), "Re: " + messages[i][0].getSubject(), messages[i][0].getPermalink());
}
}