Googlevoice保号——使用Google Drive里的脚本功能实现Googlevoice消息的自动回复

由于GV号超过6个月不使用会自动销号,因此使用gmail+Google Drive设置自动回复。

需要先设置Google Voice短信转发到Gmail邮箱,设置方法如下:

登录Google Voice,Settings—>Settings—>Forward messages to email,打开将短信转发到你Gmail邮箱的选项

然后在gmail中设置:

  1. Create a filter (any text sent to a google voice number goes to your gmail with the following address appended to it) --
    1. Matches: from:(@txt.voice.google.com)
    2. Do this: Skip Inbox, Apply label "autoreply"
  2. Add google scripts as a document type
    1. Go to Google Drive
    2. Click New --> More --> Connect more apps --> Search for "google apps scripts" (by Google) and add it.
  3. Now create a new script: New --> More --> Google Apps Scripts.
  4. Name the script "Auto Replier"
  5. Replace what you see with the code below the **********
    1. After you've saved the code, perform these steps:
    2. Click Edit
    3. Select Current Projects Triggers
    4. Select autoReplier, Time-driven, Minutes timer, Every minute
    5. Hit save.
    6. Approve any permissions that pop up.
  6. Voila, now you have an auto reply system.

 

**********

 

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中任意喜欢的标签

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值