Create a shortcut for a saved Gmail reply

I am currently using the Gmail Lab feature - canned replies. I have a lot of these finished answers and using their menus to find the right one is time consuming. It would be easier to find a canned answer:

  • associating a canned response with a keyword
  • using this keyword in the body or subject area. Something like that.

Is this possible using the Gmail API or would you suggest another way to do this?

+4
source share
2 answers

? "CannedResponses" . , , "TestLabel1". , , , script :

 
function CannedReply() {
  var label = "<mylabel>"; //eg <myLabel> = TestLabel1
  var myemail = "<me@gmail.com>";

  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);
    }
  }
}
+4

Autohotkey , , . - Gmail, , .

0

Source: https://habr.com/ru/post/1661012/


All Articles