2017-08-18 2 views
0

Google Apps for Businessの午前9時と午後5時前の月曜〜金曜のメールに返信するために上記に基づいて以下のスクリプトを作成しました。営業時間外のビジネス向けGmailアプリケーションへの自動返信

私が見ることができない何らかの理由で、それは成功していません。任意のヒント。実行すると0秒の実行時間があり、Gmail用のすべてのAPIが有効になっています。

個人のGmailでテストしたところ、ビジネス用のGmailアプリケーションとは関係がありますが、うまくいきました。

午前9時前と午後5時後の平日のための最初のスクリプトは、任意の時点で土曜日と日曜日のために何かアドバイス

を事前に

function AutoReply() { 
    var interval = 5; 
    var date = new Date(); 
    var day = date.getDay(); 
    var hour = date.getHours(); if ([6,0].indexOf(day) > -1 || (day == [6,0] && 
    hour < 24) || (day == [6,0] && hour >= 0)) 
    { 
     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 reaching out to us.Our Customer Support Team is available Monday to 
       Friday between 9am and 5pm. We are looking forward to helping you with your 
       enquiry during business hours.In the meantime, please check our Frequently 
       Asked Questions page, Delivery page or Returns page for more information 
       which can be found on our website at www.xxxxxxxxxxxxxxx.com.au and follow 
       the links at the bottom of the page."); 
       threads[i].markRead(); 
       threads[i].markImportant(); 
      } 
     } 
    } 
} 

おかげ

function AutoReply() 
{ 
    var interval = 5; 
    var date = new Date(); 
    var day = date.getDay(); 
    var hour = date.getHours(); if ([1,2,3,4,5].indexOf(day) > -1 || (day == 
    [1,2,3,4,5] && hour < 9) || (day == [1,2,3,4,5] && hour >= 17)) 
    { 
     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 reaching out to us. Our Customer Support 
       Team is available Monday to Friday between 9am and 5pm. We are looking m 
       forward to helping you with your enquiry during business hours.In the 
       meantime, please check our Frequently Asked Questions page, Delivery page or 
       Returns page for more information which can be found on our website at 
       www.xxxxxxxxxxxxxxx.com.au and follow the links at the bottom of the 
       page."); 
       threads[i].markRead(); 
       threads[i].markImportant(); 
      } 
     } 
    } 
} 

週末のバージョンです私が作成したこの混乱に欠けているエラーはありますか?

答えて

1

これはGmail自体の設定で行うことができます。設定した時間内に返信する自動応答を設定できる事前定義済みのオプションがあります。

+1

ありがとう、私は自動レスポンダーを認識していましたが、それは時間に敏感であることが確信していますか?バケーションレスポンダはオン/オフを切り替えることができますが、人為的エラーの可能性を排除するためにプロセスを自動化しようとしています。 – James

+0

自動応答は、自動的に応答したい曜日に基づいています。このタイミングに基づいて、あなたはGmailからのアクセス許可を持っている必要があります。これが自動化できるかどうかをお知らせください。コミュニティにも役立ちます。 – Avid

関連する問題