由于GV号超过6个月不使用会自动销号,因此使用gmail+Google Drive设置自动回复。
需要先设置Google Voice短信转发到Gmail邮箱,设置方法如下:
登录Google Voice,Settings—>Settings—>Forward messages to email,打开将短信转发到你Gmail邮箱的选项
然后在gmail中设置:
**********
function autoReplier() {
var labelObj = GmailApp.getUserLabelByName('autoreply');
var gmailThreads;
var messages;
var sender;
for (var gg = 0; gg < labelObj.getUnreadCount(); gg++) {
gmailThreads = labelObj.getThreads()[gg];
messages = gmailThreads.getMessages();
for (var ii = 0; ii < messages.length; ii++) {
if (messages[ii].isUnread()) {
msg = messages[ii].getPlainBody();
sender = messages[ii].getFrom();
MailApp.sendEmail(sender, "Auto Reply", "Hi, I'm out of town till the end of the month. Talk to you then!");
messages[ii].markRead();
messages[ii].moveToTrash();
}
}
}
}
*****************
来自Googlevoice论坛中rahulvarshney(6/7/17)的回复
*****************
参考VPS大玩家
他的代码中有个小错误,(上文已更改)
把sender = messages[ii].getFrom().slice(16, 74); 修改为 sender = messages[ii].getFrom();即可
感谢@VPS大玩家
其中该语句的Hi, I'm out of town till the end of the month. Talk to you then!可以改为自己喜欢的内容。
MailApp.sendEmail(sender, "Auto Reply", "Hi, I'm out of town till the end of the month. Talk to you then!");
另外messages[ii].moveToTrash();可以删除或者将Trash改为gmail中任意喜欢的标签