Trigger a process when mail arrives

I want to trigger a process when an email arrives in the outlook mailbox. How can we do it?

Hi Shivangi,
We can use Windows Task Scheduler to schedule the XAML file of your UiPath workflow every 5mins or 10mins or as per your requirements.By this way, for every scheduled interval the workflow is executed and it checks the mail box and triggers the process if required mail arrives.

Thanks & Regards,

Thanks for the reply!! Windows Task Scheduler is a way I was aware of, is there any way in UIPath that we can do for trigger.

As per my knowledge ,i don’t see any mail monitoring service activity in Uipath Studio. But i think there is an option by which you can monitor the mailbox as a service using powershell scripts and trigger the Uipath bot using REST web service if it meets the required criteria.

This is one way to trigger a process



Thanks for the flow diagram! It was exactly what I needed. Had a followup question:

What would happen if the robot is in the middle of a longer task? Would the triggered event from a new email break him? Or would he know to finish his task and then process the latest email?

1 Like

I think the flow mentioned by vvaidya, would work and it would hold the BOT for ever, we may not able to run one more BOT in that machine,

I think monitoring the mailbox via Service out of the BOT would be best and then trigger the BOT when a new mail arrive. that way the BOT would run only when its applicable, and we can utilize other BOT in that machine,

Yes this is happening. Can you please explain in detail how to do this?

Hello, I try to do the same, I’m stuck at what to put on the decision box? Can anyone please explain the condition to go on to the decision box. thanks

1 Like

Say your get outlook activity output variable is “emails”. Few things you can do are :

  1. emails.Count >0

  2. emails.Any ( 1& 2 does pretty much same job)

  3. email.Where(Function(s) s.Subject.Contains(“xyz”)).Any — Looking for Subject Keyword

  4. email.Where(Function(s) s.Attachments.Count>0).Any — Check if Email list Contains Attachments


Thank you very much it worked. :grinning:

will you please help me to understand this code with some more detail!
what is that Function(s) in both 3 and 4 th point
ans also tell me about .Any .

Hi ,
Is it possible to poll mail box with mail content rather than subject?

Hello guys,

Using the bot itself to monitor the mailbox is going to keep my bot busy. It will become a problem when i want to trigger other processes depending on different “subjects”.

Can some suggest how to monitor the mail out of the bot and using this service to start a process in orchestrator via the REST API

1 Like

Hi Anurag,
it’s tricky - not so much for UiPath but rather Outlook/Exchange-wise.
Outlook can execute rules, both client-side and server-side. However, if the execution requires some sort of “local” resources (files, playing sounds, checkin for certain words or calling macros) it will automatically turn into a client-side rule and thus can only be executed while Outlook is on screen (logged in).
See: for info on Outlook Rules.

I’m hypothizing here, as I have not tried it my self, but it should be doable, technically.

  1. You could create a rule in Outlook that via VBA/macro could trigger a REST call to ORCH. This is very high-end as you will have to be an Outlook-VBA wizard in order to produce code that calls the Orch REST. The rule would certainly become a client-side rule (because it has to be run from a windows machine and not on the Exchange Server) and thus you will still have to have the BOT online all the time.
  1. Since you can’t use UiPath Activities nor Outlook (both would need the BOT be online all the time), you must use some “external” way to connect to the Outlook account and get any new messages. This can be done through PowerShell or .Net-application - both of which you must code yourself.
    See: for the gospell on Exchange PowerShell.
    The script or app should logon to the Exchange cluster and get any New mails from the InBox (You must have the required credentials, of course). The code can determine which (if any) new mails fall into the category that should trigger your robot process. If so, make a call to Orch-REST starting your process/robot. This app/script can be triggered via the ususal scheduling services in Windows.

It sounds very easy, but in real life you’d have to be very proficient in PS, WS and Orch REST.
Goog luck :slight_smile:


1 Like

Hi Can you share the sample workflow please ?

Please check some option with powershell.

you can execute powershell script one time when machine starts and it will monitor your mail box from “OUTLOOK” not from exchange server.

once a mail arrives, you can trigger a process from script itself.

User Register-ObjectEvent in powershell , and this event will listen to new items in outlook mailbox.

example link for your reference


Hi I have a similar issue. I have a process that submits a request to customers. This dispatches a queue(scheduled to run after 1 hour). Next i have another Process which is to chk timeouts, meaning after 1 hour it picks the scheduled queue and send email to team that no response has been receieved yet from customer . Next i have 3rd process which is just checking the inbox every 5 mins looking for email response from customer . If customer responds in less than 1 hour time i would want to delete the scheduled queue so that no emails are send to the team . Please advise how can i acheieve this.

Hi I had a similar requirement. We solved this issue using the Outlook Rules functionality. We created a rule which on receiving mail with specific subject would execute a bat file. The bat file will contain script to invoke Uipath bot. Its working perfectly.

1 Like