Autoreply based on time of day

Posted on 2006-11-22
Last Modified: 2012-06-27
I'd like to set up a mailbox to send an autoreply only during certain hours - every time except for Monday to Friday 8-5, and specific holidays (like thanksgiving).

I see no time of day options in the built-in mailbox rules.  Anyone got a way to make this work?
Question by:nummagumma2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 67

Expert Comment

ID: 17996401
here's a tool that may work for you:

Otherwise, there may be a way to script a solution...

Author Comment

ID: 17997218
That's a great looking tool, but it will require manual interaction every day (turning on the rule).  Hmmm.

Expert Comment

ID: 17997237
Hi nummagumma2,
Can you set it up as a scheduled task?

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.


Author Comment

ID: 17997693
James - I'm a little confused.  How could I set up a scheduled task to turn on the "Out of office autreply" rule?
LVL 76

Expert Comment

by:David Lee
ID: 17998614
Greetings, nummagumma2.

> How could I set up a scheduled task to turn on the "Out of office autreply" rule?
I can do it with a bit of scripting.


Author Comment

ID: 17999369
That'd be pretty sweet.   I have some existing Javascript that selects the date/time that I want - since I really want to exclude M-F outside of 8-5 and also all federal holidays we observe.  I'm using it to display on a website that offers a form that feeds into this mailbox.

Would it be possible to take the same logic and apply it to your custom script so that it does the 'deed' during the 'off' time and then undoes it during the 'on' time?  Could your custom script activate/deactivate a rule on the mailbox instead of the OOOAR?

Here's that JScript:

function ISHDin () {
      // get date
      var dt_date=new Date();
      // check for hours outside 8 - 5 PST
      var dayofweek = dt_date.getUTCDay();
      var hourofday = (dt_date.getUTCHours()-8);
      if (hourofday <=0) var hourofday=hourofday+24
      if (dayofweek == 0
            || dayofweek == 6
            || hourofday < 8
            || hourofday >= 17
            )return true;

     // check simple dates (month/date - no leading zeroes)
     var n_date = dt_date.getDate(),
          n_month = dt_date.getMonth() + 1;
     var s_date1 = n_month + '/' + n_date;
     if (   s_date1 == '1/1'   // New Year's Day
          || s_date1 == '7/4'   // Independence Day
          || s_date1 == '12/25' // Christmas Day
     ) return true;
     // weekday from beginning of the month (month/num/day)
     var n_wday = dt_date.getDay(),
          n_wnum = Math.floor((n_date - 1) / 7) + 1;
     var s_date2 = n_month + '/' + n_wnum + '/' + n_wday;
     if ( s_date2 == '2/3/1'  // President's Day, third Monday in February
        || s_date2 == '9/1/1'  // Labor Day, first Monday in September
          || s_date2 == '11/4/4' // Thanksgiving Day, fourth Thursday in November
          || s_date2 == '11/4/5' // Thanksgiving Day, fourth Thursday in November
     ) return true;

     // weekday number from end of the month (month/num/day)
     var dt_temp = new Date (dt_date);
     dt_temp.setMonth(dt_temp.getMonth() + 1);
     dt_temp.setDate(dt_temp.getDate() - 1);
     n_wnum = Math.floor((dt_temp.getDate() - n_date - 1) / 7) + 1;
     var s_date3 = n_month + '/' + n_wnum + '/' + n_wday;
     if (   s_date3 == '5/1/1'  // Memorial Day, last Monday in May
     ) return true;

     return false;

LVL 76

Expert Comment

by:David Lee
ID: 17999416
Up through Outlook 2003 there's no means of scripting rules, to include turning them off and on.  (Outlook 2007 is supposed to offer this capability.)  That does not include the OOO assistant though.  It can be turned on/off in a script.  That's the closest I can get.  

Author Comment

ID: 17999770
Ok.  So, turning on/off the OOAR on a schedule is better than nothin'
LVL 76

Accepted Solution

David Lee earned 500 total points
ID: 18008656

The script below will turn the OOO message on.  You can create a second script to turn the OOO message off simply by changing this line

    objMAPISession.OutOfOffice = True


    objMAPISession.OutOfOffice = False

To use this script copy and paste the code into Notepad and save the file with a .vbs extension.  You can then create a scheduled task and have it run the code.  The task will have to run under a set of credintials that has an Outlook profile defined on the computer the task is running on.  The script will also need the profile name and password embeded in it.  Or you could get creative and add code to read them from some source.  However you choose to do this though the script has to have both in order to log in to Outlook.

Dim objMAPISession
Set objMAPISession = CreateObject("MAPI.Session")
'Change the profile name and password on the following line
objMAPISession.Logon "MyOutlookProfileName", "MyOutlookProfilePassword", False, True
objMAPISession.OutOfOffice = True
'Change the text of the out of office message on the next line as desired
objMAPISession.OutOfOfficeText = "I'm out of the office right now."
Set objMAPISession = Nothing

Author Comment

ID: 18025040
Untested, but I'll assume it works.... would deal with hours via schedule, but not holidays.  No time to test and want to award points for effort.
LVL 76

Expert Comment

by:David Lee
ID: 18026657
When you do get around to testing it, let me know if you run into any problems and I'll be glad to help you work through them.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question