Solved

Autoreply based on time of day

Posted on 2006-11-22
11
879 Views
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?
0
Comment
Question by:nummagumma2
[X]
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
11 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 17996401
here's a tool that may work for you: http://www.symprex.com/products/oox/

Otherwise, there may be a way to script a solution...
0
 
LVL 1

Author Comment

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

Expert Comment

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

JamesTX10
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Author Comment

by:nummagumma2
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?
0
 
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.

Cheers!
0
 
LVL 1

Author Comment

by:nummagumma2
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.setDate(1);
     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;
}

0
 
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.  
0
 
LVL 1

Author Comment

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

Accepted Solution

by:
David Lee earned 500 total points
ID: 18008656
nummagumma2,

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

to

    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."
objMAPISession.Logoff
Set objMAPISession = Nothing
0
 
LVL 1

Author Comment

by:nummagumma2
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.
0
 
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.
0

Featured Post

Increase your protection from Zero Day threats!

Running two Antivirus' is never a good idea.
Taking advantage of Multiple Security layers on the other hand can often save your hide.
See which top notch security software brands have been proven to happily coexist together.
Reduce your chances of becoming a statistic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Live Mail to Outlook 2010 Windows 10 6 70
Exchange 2007 6 42
Emoji's work fine in Word 2016, but not in Outlook 2016 ? 29 175
Office 365 Controls 3 17
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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 …

734 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