web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Email Auto Response Af...
Power Automate
Unanswered

Email Auto Response After Hours

(2) ShareShare
ReportReport
Posted on by 23

I'm trying to figure out if it's possible with Flow to setup an auto response on one of our shared Office 365 mailboxes to send an auto response after hours (ie: between 5:00pm and 7:00am) every day when an email comes in. I've seen some older examples and attempted to imitate setting them up as demonstrated, but it appears some various options no longer exists (like setting up a Recieved Time using a greater than operator).

 

Any which way, before I dig any deeper with failed attempts, I want to find out if it's even possible to setup such a flow that handles auto responses only during certain specific hours (and maybe as a bonus, all during the weekend as well).

Categories:
I have the same question (0)
  • Verified answer
    gamoraes Profile Picture
    1,040 on at

    Hi @ESpigle

     

    We had here a same question with answer

     

    I think this solve your request.

     

    Best Regards,

     

    Gustavo Moraes

  • v-yamao-msft Profile Picture
    on at

    Hi @ESpigle,

     

    What’s your current situation? Have you tried what @gamoraes suggested?


    If you are still having issues, please feel free post back. We are always ready to help.

     

    Best regards,
    Mabel Mao

  • ESpigle Profile Picture
    23 on at

    Sorry I didn't get back sooner. That seemed to do the trick for time of day as a condition. I just now need to figure out how to determine if it's weekend versus weekday (ie: we want to send them all day if it's the weekend) and then I'm all set.

     

    Thanks!

  • Verified answer
    v-yamao-msft Profile Picture
    on at

    Hi @ESpigle,

     

    This thread could be a reference for you:

    https://powerusers.microsoft.com/t5/Microsoft-Flow-Knowledge-Base/How-to-tell-if-the-current-time-is-within-business-hours/ta-p/31870

     

     

    Best regards,

    Mabel Mao        

  • ESpigle Profile Picture
    23 on at

    Here is my final script that appears to be working (though not fully tested). If it's Sat., Sun. or outside of business hours, it will pass the condition and move on to the next step:

     

    @or(
    	equals(
    		dayofweek(
    			UtcNow()
    		),
    	0),
     equals(
    		dayofweek(
    			UtcNow()
    		),
    	6),
    	less(
    		formatDateTime(
    			addHours(
    				triggerBody()?['DateTimeReceived'],-6
    			),
    			'HH:mm'
    		),
    		formatDateTime('08:00:00','HH:mm')
    	),
    	greater(
    		formatDateTime(
    			addHours(
    				triggerBody()?['DateTimeReceived'],-6
    			),
    			'HH:mm'
    		),
    		formatDateTime('17:00:00','HH:mm')
    	)	
    )
  • DanVentham Profile Picture
    6 on at

    Hi,

    I wish to have a set message/email reply to inbound emails when we are closed. So after 5.30pm and before 8.30am Mon to Fri. And all day Sat and Sun.

    I came acrosss this discussion and I think its what i want.  I wondered what the -6 meant in the string?

     

    triggerBody()?['DateTimeReceived'],-6

     

    Is the timezone related?  (we are un the UK)

     

    Thank you

  • ESpigle Profile Picture
    23 on at

    The -6 is offset from GMT, correct.

  • DanVentham Profile Picture
    6 on at

    Great thank you. 

    I tried using that code - 

    @or(equals(dayofweek(UtcNow()), 0),equals(dayofweek(UtcNow()),6),less(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],),'HH:mm'),formatDateTime('08:30:00','HH:mm')),greater(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],),'HH:mm'),formatDateTime('17:30:00','HH:mm')))

     

    but flow didnt like it - 

    The template validation failed: 'The template action 'Condition' at line '1' and column '1813' is not valid: "Unable to parse template language expression 'or(equals(dayofweek(UtcNow()), 0),equals(dayofweek(UtcNow()),6),less(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],),'HH:mm'),formatDateTime('08:30:00','HH:mm')),greater(formatDateTime(addHours(triggerBody()?['DateTimeReceived'],),'HH:mm'),formatDateTime('17:30:00','HH:mm')))': expected token 'Identifier' and actual 'RightParenthesis'.".'.

     

    But I assume it liked your code?

  • ESpigle Profile Picture
    23 on at

    When we had last used it, correct--it worked as provided. We have since stopped using this as there was no provision / means to only send one response to an address a day and we actually occassionally saw this get stuck in autoresponse shootouts with other email addresses that were setup to autorespond and on rare occassion we had people sometimes come into work the next day with loads of emails back and forth autoresponding to other autoresponding emails.


    I can't validate at this very moment in time if that code above still works as a result of no longer using this flow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard