09 April 2017
Gmail

Here's a cool tip that I think will help you stay more consistent with managing your time over the weekend, especially if you're a business owner and don't make enough time for loved ones over the weekend.

Gmail provides a tool called Google Scripts. We will create a Google Script that will auto reply to anyone who emails you during the following times:

  • Saturday
  • Sunday
  • Before 9AM Monday
  • Before 11AM Friday
  • After 5PM Friday

Open Google Scripts here and click the Start Scripting button. Login to your Gmail account if needed. Replace the text editor with the following snippet code and click the save button (floppy disk).

function autoReply() {
  var interval = 1;    //  if the script runs every 1 minute; change otherwise
  var date = new Date();
  var day = date.getDay();
  var hour = date.getHours();
  if ([6,0].indexOf(day) > -1 || (day == 1 && hour < 9) || (day == 5 && hour < 11) || (day == 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++) {
      threads[i].reply("Thank you for your email. I am currently out of office until Monday morning at 9AM. I will respond to your email then.");
    }
  }
}

Next click the Edit button and select "Current project's triggers" and give your project a name (AutoReply or something similar). Set the trigger for every 1 minute and allow permission for Gmail to manage your email account. That's it!

Gmail Scripts


Now anytime an email hits your inbox between those times the email response will be sent. This increases the likelihood of you managing your time more wisely with loved ones.

Comments