2016-11-17 20 views
4

我目前正在使用Gmail實驗室功能 - canned responses.我有很多這些罐頭響應並使用their menu找到合適的答案,證明是耗時的。這將是比較容易的方式來查找罐頭回應:爲Gmail預設的響應創建快捷方式

  1. 聯用在身體或主題字段是關鍵字關鍵字
  2. 罐頭回應。 Something like this.

這可以通過使用Gmail API或者你會建議另一種方式來做到這一點?

+2

我不知道,如果Gmail的API能夠做的,但我可以建議最接近的是,使用應用程序腳本通過過濾Gmail併發送回復來創建自動回覆 - 您可能需要檢查此[教程](https://ctrlq.org/code/20116-gmail-auto-replies)。您可以使用[搜索語法](https://support.google.com/mail/answer/7190?hl=zh-CN)查詢郵件。希望這可以幫助。 –

+0

也許你可以嘗試寫一個油猴腳本來做到這一點?你將不得不使用安裝油脂猴子的Firefox,但我認爲它會工作。 https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/ – Aaron

回答

4

這個工作流程如何?將標籤「CannedResponses」添加到全部您準備好的回覆。然後用回覆適用的特定標籤標記每個標籤,例如'TestLabel1'。然後,當新郵件時,你貼上標籤,之後你運行一個這樣的腳本:

function CannedReply() { 
    var label = "<mylabel>"; //eg <myLabel> = TestLabel1 
    var myemail = "<[email protected]>"; 

    var responsebody = GmailApp.search(
     "label:" + label + " label:CannedResponses" 
    )[0].getMessages()[0].getBody(); 
    var threads = GmailApp.search("label:" + label + " -label:CannedResponses label:unread"); 
    for (var i = 0; i < threads.length; i++) { 
    for (var j = 0; j < threads[i].getMessageCount(); j++) { 
     message = threads[i].getMessages()[j]; 
     message.reply("", {htmlBody: responsebody, from: myemail}); 
     GmailApp.markMessageRead(message); 
    } 
    } 
}