我是否可以将Gmail设置为“每周不在”重复发送?


11

我只在周一至周三工作。我想进行设置,以便客户在每周的这些天向我发送电子邮件时,会得到友好的提醒。我怎样才能做到这一点?看来我每周必须从外观上手动进行操作。


这个问题没有显示出任何研究成果。请结帐如何询问
鲁本

Answers:


6

我根据您的情况对类似问题了回答。如果当前日期是星期四(4),星期五(5),星期六(6)或星期日(0)之一,则此Apps脚本将进行答复。可以按照以下指示调整天数。

function autoReply() {
  var interval = 5;          //  if the script runs every 5 minutes; change otherwise
  var daysOff = [4,5,6,0];   // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
  var message = "This is my day off.";
  var date = new Date();
  var day = date.getDay();
  if (daysOff.indexOf(day) > -1) {
    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++) {
      threads[i].reply(message);
    }
  }
}

5

我认为你是对的。我只看到一种添加开始日期和可选结束日期的方法。您将无法仅通过Gmail自动执行此操作。假设有人创建了这样的东西,您将需要一些外部工具。不过,具有Google Apps脚本技能的人也许可以创建一些东西。

就其价值而言,Outlook也不允许您执行此类操作。

充其量来说,借助Gmail,您可以在任何一天使用假期自动回复器向任何人发送邮件。这很聪明,因为如果您收到一个人的多封邮件,它不会多次发送邮件。


1

我已经写了一个与user79865相比的更新版本,为回复的电子邮件添加标签而不是使用时间,这样会更准确。

function autoReply() {
  var scheduled_date = [
    '2016-12-19', '2016-12-20',
  ];
  var auto_reply = "I am out of office. Your email will not seen until Monday morning.";

  var now = new Date();
  var today = now.toISOString().slice(0, 10); // today format: '2017-01-01'

  var label = GmailApp.getUserLabelByName('auto-replyed') || GmailApp.createLabel('auto-replyed');

  // today is the scheduled date
  if (scheduled_date.indexOf(today) >= 0) { 
    // get all email inbox, unread, without label auto-replyed
    var threads = GmailApp.search('is:unread is:inbox -{label:auto-replyed}');
    for (var i = 0; i < threads.length; i++) {
      var thread = threads[i]
      // reply the email and add auto-replyed label
      thread.reply(auto_reply);
      thread.addLabel(label);
    }
  }
}

0

我将这两个脚本结合在一起,得到了带有linjunhalida标签的版本,但是能够选择日期而不是输入日期,例如在user79865的脚本中:

function autoReply() {
  var scheduled_date = [
    '2019-09-20', '2019-09-27',
  ];
  var auto_reply = "I am out of office today. I'll get back to you as soon as possible next week.";

  var now = new Date();
  var today = now.toISOString().slice(0, 10); // today format: '2017-01-01'

  var label = GmailApp.getUserLabelByName('auto-replyed') || GmailApp.createLabel('auto-replyed');

  // today is the scheduled date
  if (scheduled_date.indexOf(today) >= 0) { 
    // get all email inbox, unread, without label auto-replyed
    var threads = GmailApp.search('is:unread is:inbox -{label:auto-replyed}');
    for (var i = 0; i < threads.length; i++) {
      var thread = threads[i]
      // reply the email and add auto-replyed label
      thread.reply(auto_reply);
      thread.addLabel(label);
    }
  }
}

0

使用一段时间后,您可能还需要查看其他一些陷阱和改进:

function autoReply() {
  var interval = 5;        //  if the script runs every 5 minutes; change otherwise
  var daysOff = [1,5,6,0];   // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
  var date = new Date();
  var day = date.getDay();
  var label = GmailApp.getUserLabelByName("autoresponded");
  if (daysOff.indexOf(day) > -1) {
    var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
    var threads = GmailApp.search('is:inbox !label:autoresponded after:' + timeFrom);
    for (var i = 0; i < threads.length; i++) {
      var message = threads[i].getMessages()[0];
      if (message.getFrom().indexOf("myemail@gmail.com") < 0 && message.getFrom().indexOf("no-repl") < 0 && message.getFrom().indexOf("bounce") < 0 && message.getFrom().indexOf("spam") < 0) {
        threads[i].reply("", {
          htmlBody: "<p>Thank you for your message. I am not in the office today. If you have urgent questions you can email office@example.com. If you have other urgent enquiries you can call the office on 1800 999 002.</p><p>Best regards,<br>Name</p>"
        });
        label.addToThread(threads[i]);
      }
    }
  }
}
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.