1

I am seeking help with Outlook Webmail.

Specifically I am trying to set up auto-reply messages during certain times of the day.

Outlook offers out of office emails, but I am trying to set up rules so that I do not have to manually turn this on and off each day.

Simple enough I thought, just search the message header for specific time prefix strings such as:

"2020 07:" or "2020 08:"

And send an automated reply to them. Not elegant, but easy to set-up and use.

However, I ran into an unexpected issue. Although my own company's email server is set up on UDT (universal date time), our clients servers are set up to their local times. So on each message header there is EDT and PST as well.

So each message has strings like:

Mon, 11 May 2020:15:36:36 -0400

Mon, 11 May 2020:19:36:43 +0000

Mon, 11 May 2020:12:36:40 -0700

These mean I would send auto-replies at the incorrect time. I have tried to use the outlook rule wizard to do something along the lines of:

"2020 15:" and "2020:19" and "2020:12" or...[next set of hours to look for]

and then forward an email based on a message header containing each of these three strings, but that does not seem possible in the current version of outlook.

I do know a little bit of VBA, and can write a script if I have to, but it really feels like there should be an easy way to set this up using the existing rules tool.

Put another way, my current attempt with outlook rules looks like this:

Apply this rule after the message arrives with 
"2020 00: and 2020 17: and 2020 01:" or 
"2020 01: and 2020 18: and 2020 02:" or 
etc...

And I need behavior that works like this:

Apply this rule after the message arrives with 
"2020 00:" and "2020 17:" and "2020 01:" or 
"2020 01:" and "2020 18:" and "2020 02:" or 
etc...

Any help would be appreciated.

2 Answers 2

0

As I know, the "reply using a specific template" rule is a client only rule which could not be used in the Outlook Webmail.

Besides, to make rules apply to specified time range, you may try the "Before" and "After" conditions under Receive.

Hope this can be useful.

2
  • I am not seeing the options there upon receipt. Those only contain checking withing certain date ranges rather than times.
    – Edward
    Commented May 16, 2020 at 2:26
  • I researched a lot and found that with the features of Outlook client alone we can only achieve conditions like "2020 00: and 2020 17: and 2020 01:", but can not achieve conditions like "2020 00:" and "2020 17:" and "2020 01 : ". I'm afraid that you may need to use the VBA method to resolve your issue.
    – Jeff Yang7
    Commented May 25, 2020 at 7:22
0

All,

Figured I would put down this answer as it mostly works. Below is the VBA script that I have been using to auto-reply after hours. It is crazy to me the steps I had to go through to basically get access to this method: newMail.ReceivedTime.

First you need to to alter the registry for MS Outlook. For Outlook 2016, the path is as follows:

HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security
DWORD: EnableUnsafeClientMailRules
Value: 1

Additional details can be found at this link: https://www.slipstick.com/outlook/rules/outlook-run-a-script-rules/

You will then need to enable to developer tab in order to write and save a VBA script. Details on that can be found here: https://www.msoutlook.info/question/279

Finally you will need to write a VBA script to accomplish the auto-reply task you want and then associate it to an Outlook rule. This is what I am using in order to check for the time I received a message and then auto-replying back to the sender. I am able to leave this on 100% of the time.

Full disclosure! Occasionally, like once a month, this crashes and I do not know exactly why. My guess is that the rule I made that runs this script is also checking other conditions in addition to running this script. For instance, the rule will not reply to an auto-reply (to prevent infinite looping). This is technically a no-no for running VBA on Outlook. What I should do is define all my conditions within this script itself, but I do not have the VBA skills to code all that in, and I have real work to do rather than fumble around with what should have been a simple task.

That being said, this is a relatively simple VBA script that does what I need it to do 95% of the time. You can use it as a good starting point at least. Anyone with any pointers on what can be improved here is welcome to comment below and I will try it out.

Public Sub Check_ReceivedTime(newMail As Outlook.MailItem)

Dim obj As Object
Dim ReceivedHour As Integer
Dim newReply As MailItem
Dim msg As String

ReceivedHour = Hour(newMail.ReceivedTime)

If ReceivedHour < 6 Or ReceivedHour > 17 Then

    Set newReply = newMail.Reply
    msg = "Outside of normal office hours it is best to reach me at my cell for system emergencies. My number is XXX-XXX-XXXX"
    
    With newReply
        .To = newMail.SenderEmailAddress
        
    End With
    
    CreateMail newReply.To, msg

Else

    Debug.Print "Do not sent the automated reply."

End If

Set newReply = Nothing

End Sub


Private Sub CreateMail(ReplyAddress As String, msg As String)

Dim objMail As Outlook.MailItem

Set objMail = CreateItem(olMailItem)

With objMail
    .To = ReplyAddress
    
    .Body = msg
    .Subject = "After Hours Auto-Response"

    .Send

End With

End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .