有没有一种方法可以使用Gmail的罐头响应功能来避免电子邮件地址中的“ + canned.response”


11

如果我设置了过滤器并发送了罐装回复,则Gmail会+canned.response在回复中添加到我的用户名。

例如,假设设置了“ from:foo@example.com to:me@example.com”过滤器以发送罐头响应,那么当foo@example.com向我发送一封电子邮件时,罐头响应来自me+canned.response@example.com而不是me@example.com,表明我使用的是罐头回应。

有办法避免这种情况吗?


4
Gmail的设置中肯定没有任何东西可以控制它。我感觉答案是“否”。还要记住:(当前)这是实验室功能,尚不完全支持。
ale 2013年

Answers:


3

对于Gmail当前的“罐头响应”,要记住的一点是必须从“实验室”标签中添加。

这意味着支持可能很少,并且有可能完全消失。这个特殊的“实验室”还有许多其他问题,这些问题不在您的问题范围内,但我相信您的回答是“否”。

看来,“ + canned.response ” 的原因是为了防止某人通过将消息重发给自己甚至被回复而无意间创建的电子邮件循环。

在我的测试中,我使用了基于特定“ 发件人 ”和包含关键字的“ 主题 ” 的响应过滤器。每次都会触发罐头响应,除非我直接回复了罐头响应。

我确信大多数人都可以接受这个怪癖,但是我在测试中遇到的其他一些怪癖可能会导致Google退出此实验室。


2

我想到了一种不使用罐头响应的方式(包括response电子邮件地址中添加的引号),而是将罐头响应简单地转发到过滤后的电子邮件(收件人)。它是这样的:

function doGet(e) {
  // retrieve Id's from canned response  
  var drafts = GmailApp.getDraftMessages();
  for(var i in drafts) {
    Logger.log(drafts[i].getId() + " " + drafts[i].getSubject());
  }

  // set canned response mail
  var canned = GmailApp.getMessageById('1410f11ab42ca12d');

  // get all messages
  var eMails = GmailApp.getMessagesForThreads(
    GmailApp.search("label:cannedresponse label:unread"))
      .reduce(function(a, b) {return a.concat(b);})
      .map(function(eMails) {
    return eMails.getFrom() 
  });

  // sort and filter for unique entries  
  var aEmails = eMails.sort().filter(function(el,j,a)
    {if(j==a.indexOf(el))return 1;return 0}); 

  // forward canned response
  for(var j in aEmails) {
    canned.forward(aEmails[j]);
  }

  // mark all as read
  var threads = GmailApp.search("label:cannedresponse label:unread");
  GmailApp.markThreadsRead(threads);    
}

解释

第一行是确定您要发送的固定响应的ID。该Logger功能将有助于记录所有draf ID。将此特定ID添加到中getMessageById(Id)。接下来的三个摘要将从cannedResponse标签中获取所有未读邮件,并删除重复邮件。
根据当前的电子邮件,罐装响应被转发给不同的收件人。之后,cannedResponse标签中的所有未读电子邮件都被标记为已读。

用法

通过浏览以下网址来添加代码:https : //script.google.com
确保按下“错误”按钮来验证脚本及其用法。脚本可以基于时间间隔触发。根据需要在Resources菜单中设置触发器。
在此处输入图片说明

在这种情况下,有一些先决条件。您需要有一个名为的标签,cannedResponse并且要有一个罐头答复作为草稿。此外,为了发送罐头响应,需要使用过滤器。

屏幕截图

在此处输入图片说明


2

雅各布

您的代码正是我想要的。但是,作为我自己的完美主义者,我发现您的代码存在一些问题:

  • 发送的电子邮件将转发而不是回复。这会在主题行中添加“ Fwd:”,并可能在接收器的端部引起一些注意。
  • 我使用Gmail查看我的(非Gmail)工作电子邮件。您的代码无法与此配合。它将使用我的Gmail地址回复我的工作电子邮件,这将使收件人的眉毛更加显眼。
  • 您的设置需要在我的草稿文件夹中不断发送电子邮件。那会让我发疯。

我修改了您的代码以解决这些问题,这是我的版本:

function RespondEmail(e) {

  // set response mail
  var response = GmailApp.getMessageById('1452e6aef2c5c09f');
  var responsebody = response.getBody();

  //send response email
  var aliases = GmailApp.getAliases()
  var threads = GmailApp.search("label:respondemail label:unread");
  for (var i = 0; i < threads.length; i++) {
    threads[i].reply("", {htmlBody: responsebody, from: aliases[0]});}

  // mark all as read
  var threads = GmailApp.search("label:respondemail label:unread");
  GmailApp.markThreadsRead(threads);
}
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.