Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 886
  • Last Modified:

Autoreply based on time of day

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
nummagumma2
Asked:
nummagumma2
1 Solution
 
sirbountyCommented:
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
 
nummagumma2Author Commented:
That's a great looking tool, but it will require manual interaction every day (turning on the rule).  Hmmm.
0
 
JamesTX10Commented:
Hi nummagumma2,
Can you set it up as a scheduled task?

JamesTX10
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
nummagumma2Author Commented:
James - I'm a little confused.  How could I set up a scheduled task to turn on the "Out of office autreply" rule?
0
 
David LeeCommented:
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
 
nummagumma2Author Commented:
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
 
David LeeCommented:
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
 
nummagumma2Author Commented:
Ok.  So, turning on/off the OOAR on a schedule is better than nothin'
0
 
David LeeCommented:
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
 
nummagumma2Author Commented:
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
 
David LeeCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now