mermberfix logo x
The MemberFix Team’s got you covered.
Membership plugins

How to set up a Gmail Auto Reply for Office Hours

gmail-auto-reply-office-hours

Introduction

Overview

If you plan to be away from your Gmail account—say, a vacation or a place without access to the internet—you can set up a vacation responder in Gmail to automatically notify people that you won’t be able to get back to them right away.

When the autoresponder is active, whenever somebody sends you an email, they’ll receive an email response containing what you’ve written in your vacation auto reply.

That’s all Gmail 101…

But what if you want to reply to your customer even while you are not on vacation?

(Like, for example, when your office is closed).

Well, there is a script that helps you to do that!

Video Tutorial

Setting up the Gmail AUTORESPONDER script

The instructions on this article work for Gmail or G Suite email accounts.

1 – Go to https://www.google.com/script/start/ and click on the ‘Start Scripting‘ button.

2 – Click New Script at the top left.
New Script 300x143 - How to set up a Gmail Auto Reply for Office Hours

3 – Rename the project to whatever you want (where you see “Untitled project”) – this will be the app name.

Rename Project 320x200 - How to set up a Gmail Auto Reply for Office Hours

4 –  Replace the code in Code.gs with the code below:

function autoReply() {
var interval = 5; // if the script runs every 5 minutes; change otherwise
var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
var wkendMessage = "Hi, Thank you for contacting us. The office is now closed. All emails will be attended to when the office re-opens at 9:00am PST on Monday morning.";
var wkdayMessage = "Hi! Thank you for your email. The office hours are Mondays – Fridays 9-6pm PST. Thank you for your patience!";
var date = new Date(); var day = date.getDay(); var hour = date.getHours(); if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 18)) { 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(wkendMessage); } } else if (hour < 9 || hour >= 18) { 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(wkdayMessage); } } }
function doGet() {
 return ContentService.createTextOutput(”");
}

5 – Customize the message based on your needs.

The current message is a generic one that is set for offices that work from 09:00AM to 18:00PM.

6 –  Customize the days based on your needs.

The current week day message will be sent from Monday to Friday.

7 – When the customization is completed, click Save and Run.

8 – Then click Publish > Deploy as Web App
Web app 300x91 - How to set up a Gmail Auto Reply for Office Hours

9 – Authorize the script with your Gmail Account.

10 – Go back into “My Projects” on the dashboard

11 – Click the 3 dots icon next to the project name

12 – Select Triggers

13 – Click on Add Triggers button will appear at the bottom right

14 – Choose next options:

Choose which function to run – Autoreply
Which runs at deployment – Head
Select Event Source – Time-Driven
Select type of time based trigger – Minutes Times
Select Minute Interval – Every 5 Minutes                
Failure Notification Settings – Notify me dail

15 – Click on save

16 – Test the script and verify it works.

Results

Voila! Your after working hours emails will be auto-replied for you!

Using this script will allow you to maintain high levels of customer service!

What do you think of this tutorial?

Article Title: How to set up a Gmail Auto Reply for Office Hours

Short Description: Learn how to set up a Gmail autoresponder that applies to certain parts of the day only.

Author: Ardian Lumi

Publisher - Orgnization: MemberFix

Publisher Logo: mermberfix logo x200 1 - How to set up a Gmail Auto Reply for Office Hours

User Review
0 (0 votes)

 

Now let’s hear from you!

Are you using this script for your Gmail account?

Is this article helpful for you?

Tell us in the comments section below.

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.
In this article you’ll learn how to use MemberMouse’s native functionality to set up a free, low-tech affiliate program!
Learn how to integrate Invision Power System to Wordpress via SSO.
The secret to a successful offer in any niche is to interact heavily with your market, ask them lots of questions about their deepest frustrations, and offer the best solutions
Subscribe
Notify of
guest
163 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Melissa
Melissa
December 12, 2020 7:21 am

Well after spending HOURS and HOURS on trying to get my gmail auto reply working, there were some crucial steps that were missing in your guide, which would have saved me from so much stress! I want to help others who are also finding themselves in my situation by sharing what I did. I also found a way to add line spacing to the plain text which will at least provide a more semi-professional reply, instead of an extremely long line of unformatted text. Here is a copy of my working script: function autoReply() { var interval = 1; //… Read more »

Last edited 3 years ago by Melissa
Rebecca
Rebecca
Reply to  Melissa
December 30, 2020 10:34 pm

Thanks for doing this! I’m not able to save due to a syntax error on line 6. What did I do wrong?

Screen Shot 2020-12-30 at 5.33.23 PM.png
Victor Barannik
Reply to  Rebecca
January 29, 2021 3:40 pm

Hello Rebeca,

Please add the ” ; ” to the end of line 20

Let me know if it won’t help.

Lisa
Lisa
Reply to  Rebecca
April 18, 2021 10:10 pm

Thank so much for the information. I am unable to due to the following error. Can you tell how to resolve?

Alexandra Slovik
Alexandra Slovik
Reply to  Melissa
February 5, 2021 1:21 am

Thanks Melissa! Just curious – what time zone are you in? Is the example code based on UTC time (so PST would need to be offset by -480 minutes?)

I only ask because I pasted this code but would get automated replies BEFORE the end time I set.

Theo
Theo
Reply to  Alexandra Slovik
April 6, 2022 11:55 pm

Hey Try updating the google script timezone for the project check this out https://www.youtube.com/watch?v=nKIJchyAOus

Robyn
Robyn
Reply to  Melissa
February 12, 2021 3:13 pm

hi thanks for this but im getting Syntax error: SyntaxError: Invalid or unexpected token line: 4 file: auto reply 1.gs

Mike
Reply to  Robyn
March 23, 2021 12:50 pm

My experience with this script as well as the original was that the unexpected or invalid token was the quotation marks. It’s not that they don’t belong, but for some reason, the marks in the examples on this web page don’t always get interpreted properly by the script editor. By replacing the marks with ones from my keyboard, the errors were resolved for me. This also applies to other punctuation like dashes (-) and semi-colons (;)

Last edited 3 years ago by Mike
Mike
Reply to  Melissa
March 23, 2021 12:56 pm

Thank you Melissa — Your script worked great after a few punctuation tweaks that did not translate well to the script editor from this web page. Both the original script and your tweaks copied quotation marks, dashes, and semi-colons to my editor that my editor didn’t want to recognize. After retyping those marks, the script worked well.

I did have to change the var Interval to 5 instead of 1 since I run every 5 minutes. Your carriage returns were just what I was looking for!!

Jason Henry
Reply to  Melissa
November 9, 2021 9:58 pm

I cannot get the last line to work. I’ve retyped all the semicolons and quotation marks. What am I doing wrong?

Jacquelyn
Jacquelyn
Reply to  Melissa
February 13, 2022 12:55 pm

Hi — After setting Triggers, I got multiple replies to the same test email. How can I fix this?

Shari
Shari
Reply to  Melissa
July 25, 2022 2:18 am

When I tried to save the code, I got this: Syntax error: SyntaxError: Invalid or unexpected token line: 5 file: Code.gs
This is what line 5 shows: (copied from your code above):
var wkendMessage = Hello and thank you for taking the time to contact ushowever our office is currently closed for the weekend\n

Shari
Shari
Reply to  Shari
July 25, 2022 2:22 am

Also, we’re in Eastern time zone. I’m trying to double check where I change the hours of operation.

BTW -I’ve programmed in BASIC, ages ago, done HTML, but this type of script is new for me.

Last edited 1 year ago by Shari
John
John
Reply to  Melissa
January 19, 2024 2:21 am

Thank you!
How can I add an email exclusion list?

John
John
Reply to  Melissa
January 19, 2024 3:19 pm

Thank you!
How can I add an email exclusion list?

Susan Hatfield
Susan Hatfield
Reply to  Melissa
February 29, 2024 2:01 pm

I just did it. I tested it but it kept coming back to my email every 5 minutes with the same prompt. I changed it to 12 hours?

Christie A Canter
Christie A Canter
April 6, 2020 2:48 pm

When I try to save I get the following error:
SyntaxError: Invalid or unexpected token (line 4, file “Code.gs”)

John
John
Reply to  Ardian Lumi
September 5, 2022 11:20 pm

used this exact code and am still getting a syntax error in line 5

Jawn
Jawn
Reply to  Ardian Lumi
January 5, 2023 7:00 pm

I tried this script as i was getting the same error but now i get this error:

Syntax error: SyntaxError: Invalid or unexpected token line: 4 file: Code.gs

Etienne Beneke
May 9, 2020 1:42 pm

Hi Ardian, this is exactly what I have been searching for. Well done. Now, I have done everything and saved and Deployed as Web App. Would Gmail automatically pick this up? I sent a test message (it’s now Saturday afternoon). But I have not received an automated response. Please tell me what I have done wrong? Thank you.

(What do I do with this script?)

https://script.google.com/a/sixfoot5.co.za/macros/s/AKfycbwT7y50nPEGqaIx3Xp554uaItjoz6fmtnDsVKwXv0FwhUZm2P0/exec

Etienne Beneke
Reply to  Etienne Beneke
May 10, 2020 10:50 am

Hi Ardian, I really need your help ASAP!

Ardian Lumi
Ardian Lumi
Reply to  Etienne Beneke
May 10, 2020 3:49 pm

Hi Etienne,

I am glad to hear that you find this useful!
Unfortunately, I am unable to open the link you have sent.

Can you please check the timezone of your Google Account, perhaps that’s why you didn’t receive the email, furthermore can you try to send another email from a different account?

Feel free to reach out if you have any other questions.
Kind Regards,

Eric
Eric
May 13, 2020 8:26 am

Hello Adrian, thnx for the code.
But when I test the code, I get “Script function not found: doGet”
What do I need to add to the code?
Thnx

Ardian Lumi
Ardian Lumi
Reply to  Eric
May 13, 2020 11:15 am

Hi Eric,

Apparently saving and republishing your google script web app is not good enough. You need to save a new version and publish the new version to make sure your app gets updated properly.

Please click Publish>Deploy as Web App> and select “New” in the project version dropbox.

Feel free to reach out if you have any other questions.
Kind Regards,

Sheena
Sheena
Reply to  Ardian Lumi
May 17, 2020 6:16 pm

Hey, we get the same “Script function not found: doGet” error and don’t think it’s due to publishing it again. Looks like the script needs to have a doget function. We absolutely love your post Ardian, can you look at a solution? Thanks so much

http://googleappscripting.com/script-function-not-found-doget/

Sheena
Sheena
Reply to  Ardian Lumi
May 19, 2020 1:16 am

Thanks for the quick reply Ardian. This definitely resolved the error. Unfortunately even after following your steps the script deployed, but didn’t seem to be running. I went in and setup a timed trigger for every minute and that seemed to do that trick. Thanks again for all of your help and for posting this. Really appreciate it

Etienne Beneke
Reply to  Ardian Lumi
May 19, 2020 11:18 am

Hi there all, could you please test this script (email me) at etienne@sixfoot5.co.za and see if you get a response PLEASE? I would really appreciate this as there is no way of knowing!

Amy Matheson
Amy Matheson
Reply to  Sheena
May 23, 2020 4:42 pm

Can you post a video on how to do this–I am trying to set ours up. Thank you so much!

Kim
Kim
Reply to  Sheena
June 10, 2020 8:02 pm

I am having the same issue, can you explain what you mean by a timed trigger?

Ardian Lumi
Ardian Lumi
Reply to  Kim
June 10, 2020 9:27 pm

Hi Kim,
 
I believe Sheena changed the interval from 5 to 1:
http://prntscr.com/sxgq9u
 
Please try to change that and check how it works for you.
 
Kind Regards,
 

Amy Matheson
Amy Matheson
May 23, 2020 5:04 pm

sheena and Ardian–can you please post how to add the timed trigger to finish this tutorial.? I have got to the point where I have added lines
25. function doGet() {
26. return ContentService.createTextOutput(‘I just successfully handled your GET request.’);
27. }

What else is needed? It would be great if you can make a tutorial including the new steps needed to execute this task. Thanks so much!

Jose
Jose
May 27, 2020 3:43 pm

Hi!

Thanks for this. Really helpfull.

A quick question, is there a way to kinda temporarly stop the script without having to remove it?

Many thanks

Jose

Sanchita Ghosh
Sanchita Ghosh
May 27, 2020 7:28 pm

Hi Adrian! Thanks for the tutorial. BUt let me admit I have absolutely no clue about apps script. So I need your help to move further. Now that I have the script ready and error free, what are the next steps that i need to take to get my auto response going?

Abhay
Abhay
May 28, 2020 6:43 pm

This works like charm! Just curious if this involves any cost in terms of #times the script ran or something ?

Abhay
Abhay
May 28, 2020 7:11 pm

This solution works like a charm ! However curious to know if there is any cost involved in terms of #times the script is run or anything like that.

Maria
Maria
June 4, 2020 4:25 am

Hello- I get this message “The script completed but did not return anything.” any idea how I can resolve this?

Ardian Lumi
Ardian Lumi
Reply to  Maria
June 4, 2020 12:59 pm

Hi Maria,
 
I believe the doGet() function was empty that’s why you saw that error.
 
 
Can you please change the doGet() function slightly as shown in the screenshot here: https://prnt.sc/siv84r
 

function doGet() {
  return ContentService.createTextOutput('I just successfully handled your GET request.');
}

 
So the script should be added as an addition to the other part of the script.
 
Kind Regards,

Maria
Maria
Reply to  Ardian Lumi
June 4, 2020 10:21 pm

Thank you so much. Let me give it a try.

Maria
Maria
Reply to  Maria
June 5, 2020 3:48 am

Hello- Thank you for troubleshooting with me. I no longer get that message.. now I get “I successfully handled your GET request.” However, I sent several test emails to see if I get the auto reply and nothing. I’m I doing something incorrectly? This is the doGet()fuction added-
 
Thank you for the help.

Script.JPG
Ardian Lumi
Ardian Lumi
Reply to  Maria
June 5, 2020 9:14 am

Hi Maria,
 
May I know if you tried to send the email after your working hours?
Also, it might take up to 5 minutes to receive the email, perhaps you got the email after a few minutes?
 
Also, is it possible to change the hours from 730 and 1530 to 7 and 15?
http://prntscr.com/su7la4
 
Can you please try again after making these changes.
 
Kind Regards,
 

Last edited 3 years ago by Ardian Lumi
josh
josh
June 4, 2020 11:17 am

function autoReply() { var interval = 5; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 0=Mo, 1=Tu, 2=We, 3=Th, 4=Fr, 5=Sa, 6=Su var wkendMessage = “Hi, Thank you for contacting me. My office is now closed. All emails will be attended to when I resume work at 9:00am AEST on Tuesday morning.” var wkdayMessage = “Hi! Thank you for your email. My office hours are Tuesday – Saturday 9-6pm. Thank you for your patience! I will contact you back during working hours”;  var date = new Date();  var day = date.getDay();  var hour… Read more »

Ardian Lumi
Ardian Lumi
Reply to  josh
June 4, 2020 12:50 pm

Hi Josh,
 
Can you please change the doGet() function slightly as shown in the screenshot here: https://prnt.sc/siv84r
 
 
So additionally this code should be added:
 

function doGet() {
  return ContentService.createTextOutput('I just successfully handled your GET request.');
}

 
Please let me know if you have any other issues.
Kind Regards,
 

Last edited 3 years ago by Ardian Lumi
Angelo Ramos
Angelo Ramos
June 7, 2020 6:46 pm

Hi Adrian!
The script is working perfectly, thank you for this amazing solution.
I’m ZERO code…and I would like to tweak a little the responder message. Maybe add my logo, change the paragraph style. Is there any way you can help me with this? Please feel free to contact me via email, but no during the weekend because I have an auto-responder! ha ha ha

Ardian Lumi
Ardian Lumi
Reply to  Angelo Ramos
June 10, 2020 9:23 pm

Hi Angelo,
 
I am glad to hear that is working for you!
 
Unfortunately, the script doesn’t accept images at the moment and we can’t change the style of the paragraph, you can change the text though.
 
I know that this may not be quite the answer that you were hoping for, but please let me know if there is anything else that I can help with.
Kind Regards,

Diana Gregorio
Diana Gregorio
June 12, 2020 1:41 pm

Hello Ardian and Sheena, I got same issue with Sheena. I tried the solutions that you give to sheena and it works. However, when I tried to sent email to the email address I created the script, the autoresponder is not sending the auto reply. May I know what is the timed trigger that I need to add in able for the autoresponder to work, please?

Diana Gregorio
Diana Gregorio
Reply to  Ardian Lumi
June 12, 2020 2:47 pm

Thank you for responding Ardian. I tried to test it during outside of working hours but it is not working. Did I missed some of the settings? Please help me. I posted this code:   function autoReply() { var interval = 5; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hi, Thank you for contacting us. The office is now closed. All emails will be attended to when the office re-opens at 9:00am PST on Monday morning.” var wkdayMessage = “Hi! Thank you… Read more »

Ardian Lumi
Ardian Lumi
Reply to  Diana Gregorio
June 12, 2020 6:33 pm

Hi Diana,
 
Can you please change the interval to 1.
http://prntscr.com/synump
 
It should be var interval = 1;
 
When you make the change please click Publish > Deploy as Web App > and select “New” in the project version dropbox.
 
Kind Regards,

Diana Gregorio
Diana Gregorio
Reply to  Ardian Lumi
June 13, 2020 1:40 pm

I already changed it to 1. But nothing happens. I hope you can help me fix the problem. What should I choose in Who has access to the app:? Is it only Myself? or Anyone?

Debbie
Debbie
Reply to  Diana Gregorio
June 15, 2020 9:55 pm

Hi Diana, not sure if this is of any use but I came across ‘boomerang’ which lets you pause your inbox, sending out an auto-response, and can be scheduled to ‘un-pause’. I’m using that as an interim as I can’t get this to work. I pause it when i finish work and set it to come back on again the following morning. Works ok so far ????????

Diana Gregorio
Diana Gregorio
Reply to  Debbie
June 16, 2020 1:29 pm

Thank you Debbie, I followed all the instruction of Ardian but it’s not working on our end. I’ll check this out and try it. Thanks!

Debbie
Debbie
June 12, 2020 5:41 pm

Please help: I (thought) I’d followed your instructions but I’m also not getting an auto response when I send a test email from another account. Any ideas please?

Ardian Lumi
Ardian Lumi
Reply to  Debbie
June 12, 2020 6:36 pm

Hi Debbie,
 
Can you please change the interval to 1.
http://prntscr.com/synump
 
It should be var interval = 1;
 
When you make the change please click Publish > Deploy as Web App > and select “New” in the project version dropbox.
 
Kind Regards,

Debbie
Debbie
Reply to  Ardian Lumi
June 12, 2020 8:43 pm

Thanks – I did this but still nothing. Can you spot anything wrong? function autoReply() { var interval = 1; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hi, Thank you for contacting us. It is now outside working hours. All emails will be attended to on Monday morning. Enjoy your weekend!” var wkdayMessage = “Hi! Thank you for your email. Our working hours are Mondays – Fridays 9-4pm. Thank you for your patience!”;  var date = new Date();  var day = date.getDay();… Read more »

Debbie
Debbie
Reply to  Ardian Lumi
June 14, 2020 11:17 am

So I now have this and still can’t get it to work? Am desperate to get it to work today as I know a client is expecting to book an appointment today for tomorrow…   function autoReply() { var interval = 1; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hi, Thank you for contacting us. It is now outside working hours. All emails will be attended to on Monday morning. Enjoy your weekend!” var wkdayMessage = “Hi! Thank you for your email.… Read more »

Last edited 3 years ago by Debbie
Debbie
Debbie
Reply to  Debbie
June 14, 2020 12:26 pm

It’s overriding the automatic vacation reply that I just put on, but still not sending out an email. Does it make a difference that it tells me this at the top? This project is running on our new Apps Script runtime powered by Chrome V8
 
 

Debbie
Debbie
Reply to  Ardian Lumi
June 14, 2020 2:29 pm

Thanks – I have tried removing it and starting from scratch but still no joy. Does the banner message at the top affect anything about runtime?

Debbie
Debbie
Reply to  Ardian Lumi
June 15, 2020 1:58 pm

Yes – I have, over 20 times now 🙂 I then remove each one and start over. I do not get an error message at all. I was just asking about the fact that it says it is running on the new apps script and whether this would mean I had to update something somewhere. Clearly if the script is right, and others have managed to get it working, I must have a problem in the saving and running of it so am trying to figure out what as this would be SO helpful to me. Lockdown has blurred the… Read more »

Robert Locke
Robert Locke
June 17, 2020 10:00 pm

How do you change it to have start and start and stop times that are not on the hour? I end my day at 3:30.

Lanetra
Lanetra
August 10, 2020 7:08 pm

Hello,

I’m currently off Sat- Mon. How do I edit this to include Mondays off?

Christina Colburn
Christina Colburn
Reply to  Lanetra
August 14, 2020 5:05 am

How do I change the code to reflect my office hours? I know how to change the message, but how do I program it to only go out during my actual office hours?

Bo Dudek
August 26, 2020 3:44 pm

Hi Like the idea a lot, and I wanna correct a bit, so I will make it read a xml file, that includes information whether I am at work or not. This xml I can write to from my phone, so in this way I can activate / deactivate auto-response from my phone. However, I don’t get the concept of the function and the interval. The main function is named autoReply() and the 2nd line is var interval = 5; But does Google just look for the interval variable and run the script every interval minutes? In my little developer… Read more »

Bo Dudek
Reply to  Bo Dudek
August 26, 2020 4:07 pm

.. and to reply to myself: I’ve found it, that there’s a (new?) feature called triggers, that you need to setup e.g. to make the function run e.g. every 5 minutes, and it should be available here https://script.google.com/home/triggers

Have fun! 🙂

Justin
Justin
August 31, 2020 1:39 pm

I like this script and it works just fine, except now, it responds to ALL of my emails, even noreply emails. Is there a function I can add that will allow me to respond only to certain email domains, or something?

Victor Barannik
Reply to  Justin
December 26, 2020 9:13 am

Hello Justin,

We will check it and if it’s possible we will update the article.

David
David
Reply to  Justin
June 29, 2023 11:00 pm

You can create a Google group with a list of all emails you want the response to send to and set the script to only send to users on that list through an if statement.

luis
luis
September 7, 2020 12:57 pm

Hi Ardian,

Thank you for providing this tutorial, I have 2 questions.

  1. how can you change the time zone in the code, I am in new york, eastern time
  2. my office hours are from 8am-2:30pm, how can i add the extra 30 minutes in the code.
Victor Barannik
Reply to  luis
December 26, 2020 9:32 am

Hello luis,

You also need to add minutes to your condition:

var date = new Date();
var day = date.getDay();
var hour = date.getHours();
var minute = date.getMinutes();
if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 14 && minute >=30 ))
Kira
Kira
Reply to  Victor Barannik
March 23, 2022 3:00 am

Where do you place this additional code in the grander code? I entered it where I thought it went and it stopped the automation from working altogether.

Dani
Dani
September 16, 2020 9:25 pm

How do you change it to work for EST?

Victor Barannik
Reply to  Dani
December 26, 2020 9:51 am

Hello Dani,

You need to add a time offset:

var offset = -300; //Timezone offset for EST in minutes.
var currentDate = new Date();
var date = new Date(currentDate.getTime() + offset*60*1000);
Last edited 3 years ago by Victor Barannik
Kira
Kira
Reply to  Victor Barannik
March 23, 2022 3:00 am

Oops meant to post this here: Where do you place this additional code in the grander code? I entered it where I thought it went and it stopped the automation from working altogether.

Kara
Kara
September 16, 2020 9:31 pm

I’ve had different people emailing me to test it out. Some have had it work, one time it looked like I sent it to myself, and others just didn’t receive anything… How is that possible? Also, I’m on an all-staff list and it worked then. Is there a way to disable a particular list or spam email from getting the auto reply? function autoReply() { var interval = 5; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hi, Thank you for contacting me.… Read more »

Amen Saran
September 25, 2020 2:46 am

Hi there, this is the script I wrote based on the information you provided. However, I keep getting an error: SyntaxError: Invalid or unexpected token (line 5, file “Code.gs”) Please let me know what I have done wrong. My business hours are from Monday to Friday from 10am to 5pm, I would need the below script / Auto Responder to run outside of those hours and including weekends. Please help me, I look forward to hearing back from you soon! Cheers, Amen info@resumeninjas.ca function myFunction() {  function autoReply() { var interval = 1; // if the script runs every 5… Read more »

Heather
Heather
September 27, 2020 1:10 am

Ardian,
I am hoping you can help! When I test the web app for the latest code, I receive the error: Script function not found: doGet
Suggestions please?
Thank you so much,
Heather

Victor Barannik
Reply to  Heather
December 26, 2020 9:54 am

Hello Heather,

Every webapp in Google Apps Script must have a main function called doGet() which is the entry point of the app, the function that your app will start with when you type the webapp URL.

This is true for every application deployed as a standalone app and called by its url – with a user interface or not.

So you need to just use a function called “doGet” from which you start your program execution.

MJ Pagay
MJ Pagay
November 4, 2020 12:23 pm

I had published it already.
Why its not working. I still don’t have auto responsder?

TONI DALESSANDRO
TONI DALESSANDRO
Reply to  MJ Pagay
November 21, 2020 1:32 pm

I had to manually add a timed trigger to make it work (not in the code). Click Edit – current projects trigger – … and then add one from that page.

Daren White
Daren White
November 20, 2020 3:53 pm

Worked a treat! Thanks Ardian

SETH TYE
SETH TYE
November 28, 2020 6:13 pm

When i do this, it sends myself a copy of the email over an over again every minute. how do i prevent this from spamming my inbox with email?

Screenshot_20201128-111236_Gmail.jpg
Victor Barannik
Reply to  SETH TYE
December 26, 2020 10:02 am

Hello Seth,

Did you change anything on the script?

If yes can you send it?

George Papidas
George Papidas
Reply to  SETH TYE
December 29, 2020 10:21 am

same for me

Kussain M
Kussain M
Reply to  George Papidas
January 15, 2021 12:04 pm

same for me
here is my script

function autoReply() {
var interval = 5// if the script runs every 5 minutes; change otherwise
var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
var wkendMessage = “Hello, Thank you for your email. The office is now closed. All emails will be attended to when the office re-opens at 8:30 am on Monday morning. Thank you for your patience!”
var wkdayMessage = “Hello, Thank you for your email. The working hours are Mondays – Fridays 8:30am -17:30pm. Thank you for your patience!”;
  var date = new Date();
  var day = date.getDay();
  var hour = date.getHours();
  if (wkend.indexOf(day) > –1 || (day == 5 && hour >= 1730)) {
    var timeFrom = Math.floor(date.valueOf()/1000) – 60 * interval;
    var threads = GmailApp.search(‘is:inbox after:’ + timeFrom);
    for (var i = 0i < threads.lengthi++) {
      threads[i].reply(wkendMessage);
    }
  }
  else if (hour < 830 || hour >= 1730) {
    var timeFrom = Math.floor(date.valueOf()/1000) – 60 * interval;
    var threads = GmailApp.search(‘is:inbox after:’ + timeFrom);
    for (var i = 0i < threads.lengthi++) {
      threads[i].reply(wkdayMessage);
    }
  }
}
function doGet() {
 return ContentService.createTextOutput(“”);
}

solika
solika
Reply to  Kussain M
June 16, 2021 6:30 pm

Did anyone get a solution for this I’m getting that same issue?

David
David
Reply to  SETH TYE
June 29, 2023 11:03 pm

The solution I found for this is once the auto responder is sent have your script mark the message as read. The script is set up to run for any new emails after a certain hour of the day, so if the email is not marked read the script will send the auto reply on a loop.

Yandhira F
Yandhira F
November 30, 2020 5:26 pm

Hi, when I tried this I got this error ” This app isn’t verifiedThis app hasn’t been verified by Google yet. Only proceed if you know and trust the developer.” Please help

Victor Barannik
Reply to  Yandhira F
December 26, 2020 10:08 am

Hello Yandhira,

You need to click Advanced -> Go to… link.

You will find more information here: https://developers.google.com/apps-script/guides/client-verification

Belen Rodriguez
Belen Rodriguez
December 5, 2020 6:40 pm

Hi Ardian,

I tried setting up the script and got this error: Authorization required
Out of Office Script needs your permission to access your data on Google.

I “reviewed my permissions”, was able to set it up, ran it as a web app, but I’m not getting any email responses when I send a test from another account.

Could you please help me figure out how to fix this? Thank you.

Last edited 3 years ago by Belen Rodriguez
Belen Rodriguez
Belen Rodriguez
Reply to  Belen Rodriguez
December 5, 2020 6:46 pm

Additionally, when I test the app directly from the Script Dashboard I get this error: Script function not found: doGet.

Thank you.

Victor Barannik
Reply to  Belen Rodriguez
January 29, 2021 3:36 pm

Hello Belen,

Do you have the next function in the end of the script:

function doGet() {
 return ContentService.createTextOutput(””);
}

If not, please add it and try again.

george papidas
george papidas
December 17, 2020 6:20 pm

Unfortunately nothing works for me. can Someone please let us know how to set Office hours with autoreply google script?
I would greatly appreciate your support on this

Victor Barannik
Reply to  george papidas
December 26, 2020 10:09 am

Hello George,

What exactly doesn’t work? Do you have any errors?

George Papidas
George Papidas
Reply to  Victor Barannik
December 28, 2020 10:37 am

Hello Victor

Thank you for coming back to this.

Following the updated post, it works!

Thank you very much in advance
George

Last edited 3 years ago by George Papidas
George Papidas
George Papidas
Reply to  Victor Barannik
December 29, 2020 10:01 am

HEllo Victor!

The email keep sending the autoreply message to himself everyminute.

Is this normal? haha

which trigger should i choose for not sending every minute?
Thank you so much

Victor Barannik
Reply to  George Papidas
January 29, 2021 3:33 pm

Hello George,

Please try to change this parameter:

Select Minute Interval – Every Minute         
to
Every 5 Minutes

Also, it can be caused if you get an email from yourself on a day off or out of working time. It will launch the chain of emails that will be sent to your mail. Just eliminate it and this issue will be solved.

Justin Albring
Justin Albring
December 18, 2020 12:16 am

Thanks for this. how do i change to CST time?

Victor Barannik
Reply to  Justin Albring
December 26, 2020 10:11 am

Hello Justin
,
You need to add a time offset:

var offset = -360; //Timezone offset for CST in minutes.
var currentDate = new Date();
var date = new Date(currentDate.getTime() + offset*60*1000);
George Papidas
George Papidas
Reply to  Victor Barannik
December 28, 2020 10:48 am

Hello Victor,

Thank you for coming back to this.

The main thing that confuses me, is that the autoreply operation does not responds to the mails. While testing the script that

Victor Barannik
Reply to  George Papidas
January 29, 2021 3:27 pm

Hello George,

So the script doesn’t work at all?

Alexandra
Alexandra
Reply to  Victor Barannik
February 16, 2021 11:19 pm

Yes after I also added this timezone offset code, the script won’t throw errors, but also doesn’t send any automated replies AT ALL, even after the set end time hours. I had the same issue

Alexandra
Alexandra
Reply to  Victor Barannik
February 16, 2021 11:52 pm

So after testing the getHours() function in W3schools (https://www.w3schools.com/jsref/jsref_gethours.asp) I found that the function pulled my local time. So is the offset for timezone necessary?

The offset code did not work for me (PST, -480), and the original code does work but works all the time; in other words, I receive auto replies before the actual end time I’ve set

Johnnie
Reply to  Victor Barannik
February 9, 2021 11:45 am

Hi Victor, I am in CET +1 timezone, what do I need to add and where exactly in the code? thank you in advance hope to get an answer

Johnnie
Reply to  Johnnie
February 9, 2021 11:51 am

script wortks but in working hours instead of out of office hours

Chris
Chris
December 19, 2020 5:57 pm

I can’t get the script to work. It’s Saturday and I sent emails to all three of my email accounts with this script and I’m getting no auto response. I did everything stated in your instructions but it’s not working. Does this send a auto response on weekends??

Victor Barannik
Reply to  Chris
December 26, 2020 10:14 am

Hello Chris,

Yes, it has to send an auto-response on Saturday and Sunday.

Did you change anything on the script?

Did you any errors while publishing the script?

Mike Murphy
Reply to  Chris
January 3, 2021 11:50 pm

Whoops…commented in the wrong spot. Sorry.

Last edited 3 years ago by Mike Murphy
Mike Murphy
January 3, 2021 11:51 pm

Hi there, I keep getting the same errors the others are getting.

My office hours are Monday to Thursday, 8:00am to 4:00pm EST and Fridays 8:00 to 12:00pm EST.
I keep getting an error that says “Syntax error: SyntaxError: Invalid or unexpected token line: 4 file: Code.gs”
Here’s my code:
function autoReply() {
var interval = 5; // if the script runs every 5 minutes; change otherwise
var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su
var wkendMessage = “Hello, and thank you for contacting us. Our office is now closed. All emails will be attended to when the office re-opens at 8:00am EST on Monday morning.”
var wkdayMessage = “Hello and thank you for your email. Our office hours are Monday to Thursday, 8:00am to 4:00pm EST and Fridays 8:00am to 12:00pm EST. Thank you for your patience!”;
var date = new Date();
var day = date.getDay();
var hour = date.getHours();
if (wkend.indexOf(day) > –1 || (day == 8 && hour >= 16)) {
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(wkendMessage);
}
}
else if (hour < 8 || hour >= 16) {
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(wkdayMessage);
}
}
}
function doGet() {
 return ContentService.createTextOutput(”“);
}

Victor Barannik
Reply to  Mike Murphy
January 29, 2021 3:21 pm

Hello Mike,

You missed “;” in this line:

var wkendMessage = “Hello, and thank you for contacting us. Our office is now closed. All emails will be attended to when the office re-opens at 8:00am EST on Monday morning.”

Mae Barcelona
Mae Barcelona
January 11, 2021 5:07 pm

Hi Everyone – can someone help me customize this to be sending one message from Monday to Sunday – outside the hours of 8am and 6pm? It works every weekday but I could not figure out how to eliminate the weekend conditions

Thank you!

Victor Barannik
Reply to  Mae Barcelona
January 29, 2021 3:19 pm

Hello Mae,

You need to remove this condition:

if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 18)) {
    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(wkendMessage);
    }
  }
Allerlay
January 19, 2021 6:13 pm

Hi, thanks for this script. It was exactly what I was looking for.
But for some reason I received an auto reply myself every minute, woke up this morning to 1500 emails from myself.
And is it possible to exclude certain recipients from getting the auto reply message?

George
George
Reply to  Allerlay
January 22, 2021 2:04 pm

same for me. any suggestion?

Maya
Maya
Reply to  Allerlay
January 27, 2021 2:08 am

me too!! how do we stop that!

Bea
Bea
Reply to  Maya
January 28, 2021 10:41 pm

I had the same problem… but I think I figured it out – When setting up your trigger, the settings above say “Select Minute Interval – Every Minute” but the code is written to run every five minutes… so it’s spamming our inboxes. Change your trigger setting to run every five minutes so it matches the script.

Victor Barannik
Reply to  Bea
January 29, 2021 3:16 pm

Hello Bea,

You are partly right. It’s because of the not synchronized script.

Also, you can start getting emails for each email you send to yourself. So you can eliminate this sequence and it will stop.

solika
solika
Reply to  Bea
June 16, 2021 6:44 pm

That doesn’t seem to work for me. Its lessened so I’m not getting an email duplicated to me every minute, but now it’s every 5 minutes.

Alexandra Slovik
Alexandra Slovik
February 5, 2021 12:00 am

Thanks for sharing this code!

I do have a question. I changed the closing hour to 16 (4pm) and sent myself an email from a different account BEFORE 4pm to test. It was 3:48pm and I received an auto reply.

Any suggestions on what happened and how to fix this?

Alexandra Slovik
Alexandra Slovik
Reply to  Alexandra Slovik
February 5, 2021 12:06 am

This is what the code looks like:

if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 16)) {
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(wkendMessage);
}
}
else if (hour = 16) {
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(wkdayMessage);
}
}

*Note that I only changed 18 to 16 – everything else is exactly copied from above

Last edited 3 years ago by Alexandra Slovik
Alexandra Slovik
Alexandra Slovik
Reply to  Alexandra Slovik
February 5, 2021 12:10 am

if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 16)) { 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(wkendMessage); } } else if (hour = 16) { 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(wkdayMessage); } } This is what I meant to paste – I'm honestly not sure how that code (else if(hour = 16)) was pasted from above. It doesn't… Read more »

Alexandra Slovik
Alexandra Slovik
Reply to  Alexandra Slovik
February 5, 2021 12:54 am

I didn’t realize I needed to add the time offset, especially since the text in the example mentioned PST (which is where I am). I think the offset should be mentioned in the actual article, along with many examples. The comments were very helpful!

Johnnie
Reply to  Alexandra Slovik
February 9, 2021 11:13 am

Hi Alexandra, would you be kind to share what I need to add to script to get the reply in my timezone? mine is CET or GMT+1 and my out of office reply started arriving in my working hours? I can not find where in the script and how to set the correct timezone? thank you in advance

Johnnie
February 8, 2021 7:36 pm

hi, I have copy/pasted the code without an modification just to try it and I get this error:
Syntax error: SyntaxError: Invalid or unexpected token line: 25 file: Code.gs

image attached

Untitled-1.jpg
Johnnie
Reply to  Johnnie
February 9, 2021 11:14 am

after several tries, deleting code and getting it back it saved it….but now I ger replies in my working times instead of closing hours? where do I add the timezone?
thanks

Tuba
Tuba
Reply to  Johnnie
February 12, 2021 7:27 am

It gives the same error for me in line 25. Could not solve it still, I need help!

Alexandra
Alexandra
Reply to  Johnnie
February 16, 2021 11:26 pm

I tried adding the timezone, thinking it had worked – but now I do not get any automated replies even AFTER the time. When I remove the code for the timezone offset, I get replies, but I also get replies BEFORE the end time I set. So I still don’t know what is going on. The offset is calculated in minutes difference from UTC (GMT), so since CET is one hour ahead it would be 60. It was recommended to paste this in the lines before the if/else statements, where you see var date = new Date(); (you will have… Read more »

Claudiu
Claudiu
February 9, 2021 3:03 pm

I have made a script to automatically reply when I’m outside of working hours. The sender receive one message from me, as expected. However, I am getting an email with the same content every minute, until I actually read the customer email.
I do not want to mark the email as read until I actually read it.
Is there a solution of stopping sending these emails? Thank you!

Capture.PNG
Eve
Eve
March 16, 2021 2:20 pm

Okay. So I have the script running, and it works. HOWEVER it keeps replying. To me.

So it replies to the initial email once , and then it keeps sending the reply to me (every minute), not the initial sender (luckily). I have added a code to label the emails that it replies to to be marked as read and important, which I think is why it at least isn’t replying to the sender of the original email.

DRY411S
DRY411S
Reply to  Eve
March 18, 2021 5:56 pm

It seems to me that there are many ‘doom loops’ in this code.

Example:

  1. You get an email from an email address that does not handle replies.
  2. You reply with the code in this script
  3. The reply is bounced with an ‘unknown recipient’ message from an email address which also does not handle replies
  4. You reply with the code in this script
  5. Goto step 2.
Mike
March 23, 2021 1:31 pm

Adrian,

Thank you for posting this script. Just so your readers like me who do not know scripting can understand if they get errors at punctuation, if you copy and paste the script into your editor, the punctuation marks sometimes get misinterpreted by the editor. Just replace the red underlined marks with ones from your keyboard, and then they should work.

Thanks to Melissa who brought up the “\n” command to insert “carriage returns” (showing my age).

DRY411S
DRY411S
April 8, 2021 2:25 pm

I wrote a script that switches your GMail Out of Office Autoresponder on and off depending whether there is an Out of the Office event in your calendar. (Note that OOTO Calendar events are not available for ‘free’ google accounts. This means that your script can use the GMail GUI for creating your OOTO message, you do not need to hard code it into your script. /**  * Looks <interval> minutes into the past and the future for OOTO entries in the Calendar  * <interval> currently set as 15 minutes in the code  * This script should be triggered to run for double the interval setting (e.g. 30 minutes if interval is 15)  *   * Sets GMail Out-of-Office AutoReply ON if there is a current OOTO event in the primary calendar  * or an OOTO is due to start within the next <interval>  * Aligns the GMail Vacation start and end date with the Calendar OOTO date/timestamp  *   * Sets GMail Out-of-Office AutoReply OFF if there is no current OOTO event in the calendar  * or an existing one will end during this <interval>  *   * The script DOES NOT CHANGE the GMail vacation responder options for domain emails and the user's Contacts  * Behaviour of the above is not what you might expect  * See https://support.google.com/a/thread/103802728?hl=en  * The script DOES NOT CHANGE the GMail vacation responder subject title or message contents  * These should be set manually by the user in the GMail settings  *  * NOTE: Gmail uses rounding to display vacation start and end times to the nearest DAY  * in the GMail settings GUI. This script sets the start and end times to be identical to  * the OOTO event start and end time. Gmail settings GUI do NOT display these as you might expect  * but testing has shown that they are being used correctly  *   * PROVIDED WITHOUT WARRANTY OR SUPPORT  *   */ function syncCalendarOOTOWithGMailOOTOAutoReply () {   var interval = 15 // minutes   /**    * Get the API response for events between    * <interval> minutes in the past    * and <interval> minutes in the future    */   var now = new Date();… Read more »

Alex Meyers
Alex Meyers
June 2, 2021 11:31 pm

How can I set this up to respond through the default email address for the account?

Jack
Jack
June 5, 2021 9:32 pm

This was very helpful, thank you!

Now if only there were a way to link it to a series of calendar events?

cook
cook
July 18, 2021 5:44 pm

This helps me lot. Thank you! What could I do if I don’t want to autoreply emails from specific email address?

Mark P
Mark P
August 15, 2021 4:23 am

Hello, the script has no errors but once someone has emailed me in the allotted time, it autoreply’s to me(from me) afterwards sending me up to 100 emails stating my after hours message, here’s my code. Not sure if i did something wrong. It seems if the email is left unread, then it Autoreply’s to myself until I’ve opened the email. function autoReply() { var interval = 5; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hello and thank you for taking the… Read more »

Pras
Pras
September 29, 2021 5:37 pm

Thank you for this! It works great! However, the auto-reply message is sent out in boring Arial font. Is there a way to change the font of the auto-reply to the font we have set for our e-mail?

Rob
Rob
November 7, 2021 4:43 pm

It seems like the fatal flaw of this script is the continuous looping of auto reply messages. For example I received an email that it auto responded ot, and then that email itself had an auto responder, then this script replied back to that… you can see where I’m going with this. I’m not sure if there is a way to make it only respond ONCE per sender like the actual vacation responder does, otherwise this is useless.

Jeremy
Jeremy
Reply to  Rob
December 22, 2021 11:03 pm

I made a much more betterer one after finding the same flaw. Plugged it together from multiple sources, and lets you customise the message with a HTML file in your Drive root. You need two triggers though: https://stackoverflow.com/a/68458557 I just can’t figure out why I can’t embed a base64 image into it though. function initializeLogs(){   //Get Script properties   var scriptProperties = PropertiesService.getScriptProperties();   scriptProperties.setProperty('email',''); } function autoReply() {     //Get Script properties   var scriptProperties = PropertiesService.getScriptProperties();   var emailLogs = scriptProperties.getProperty('email');   Logger.log(emailLogs); var interval = 1; // if the script runs every 5 minutes; change otherwise var wkend = [6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su     // get html message         var files = DriveApp.getRootFolder().getFilesByName('autoreply.html');     var htmlbody;     while (files.hasNext()) {       var file = files.next();       htmlbody = file.getBlob().getDataAsString('utf8'); }   var date = new Date();   var day = date.getDay();   var hour = date.getHours();   if (wkend.indexOf(day) > -1 || (day == 5 && hour >= 17)) {     var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;     var threads = GmailApp.search('is:inbox after:' + timeFrom); for (let mess of threads) {     if (mess.getMessageCount() == 1) {            //get email address of the message sender       var sender = mess.getMessages()[0].getFrom();       if(!emailLogs.includes(sender)){         Logger.log(sender);         //sender not yet in the logs, send reply       mess.reply("", {           htmlBody: output         });          //add sender to the logs         scriptProperties.setProperty('email', emailLogs+sender)             }     }   }   }   else if (hour < 8 || hour >= 17) {     var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;     var threads = GmailApp.search('is:inbox after:' + timeFrom); for (let mess of threads) {     if (mess.getMessageCount() == 1) {… Read more »

Steve
Steve
Reply to  Jeremy
February 3, 2022 12:46 pm

Jeremy, thanks for your code. It saved with no error. So how do I create the HTML file, I have never worked with root drive and can barely code. I can copy and paste though! Steve

Jeremy
Jeremy
Reply to  Steve
February 4, 2022 1:21 am

No worries Steve,

It’s just a web html file called “autoreply.html” saved in the top level of your Drive.

By that, I mean it’s not in any folders, and it’s just there under the Files section.

Orlec
Orlec
Reply to  Jeremy
May 2, 2022 3:04 pm

Hi, Jeremy. I tried using your code. It sent an autoreply but the email reply was empty. What could have been the problem?

Jeremy Virgo
Jeremy Virgo
Reply to  Orlec
May 2, 2022 11:19 pm

Could have been a HTML thing. I found it was very picky as to what it’ll use. No pictures for example would work for me.

Lena
Lena
January 18, 2022 10:30 pm

Could please you help me with the changes that would be needed to have this run only on Fridays between 8am and 5pm?

AFGM
AFGM
March 15, 2022 1:38 pm

NEED HELP: My time zone is UTC +8 but I have to follow the PST time, what can I do to make the code follow the PST time?

Carlos Urtubia
Carlos Urtubia
April 3, 2022 7:15 pm

Thank you for this.
Work like a charm. However, I have a question. I have a system that creates tickets from emails and I’m creating a loop when the script is working, how could I make this to work with all the incoming emails, except for this particular email address?

Thank you

Bob
Bob
August 22, 2022 10:58 am

Hi, I work Tues-Thurs, 8:15am to 5pm, so I’ve adapted the script. But then noticed that at my work email I got 17 messages in 17 minutes about the email I had sent to my work email from my personal email, Any ideas? function autoReply() { var interval = 5; // if the script runs every 5 minutes; change otherwise var wkend = [1,5,6,0]; // 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa, 0=Su var wkendMessage = “Hi. Thank you for contacting me. As I work part-time, I will attend to emails during my working days (Tuesdays, Wednesdays & Thursdays).”; var wkdayMessage… Read more »

Bob
Bob
Reply to  Bob
August 22, 2022 1:31 pm

Solved. Set trigger to 5 mins in Google settings to match the script.

Tara
Tara
October 21, 2022 5:19 pm

Can anyone help me alter the script for responding different times Saturdays and Sundays? My office is open 8am-12pm Saturday and closed Sunday.