Solved

Autoreply based on time of day

Posted on 2006-11-22
11
872 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
11 Comments
 
LVL 67

Expert Comment

by:sirbounty
Comment Utility
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
Comment Utility
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
Comment Utility
Hi nummagumma2,
Can you set it up as a scheduled task?

JamesTX10
0
 
LVL 1

Author Comment

by:nummagumma2
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:nummagumma2
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now