Trigger Job When A New Email Is Received In The Outlook

What are the different ways to trigger the job whenever new mail is received in the Outlook mailbox?

There are some possible ways to achieve the requested scenario. Use any of the below approaches which suits best according to the business request,

  1. This approach needs a dedicated Robot which is running just to monitor the Mail box and take appropriate action of executing other jobs.

  1. In case the job is not required to immediately run as soon as the email arrives, schedule to move the required data in email to UiPath queue and make other Processes consume the Queue data. This utilizes the dedicated Robot used in Option 1.

There are three kinds of trigger parameters available for the queue. Go through this link Queue Trigger to know about a detailed explanation of queue triggers.

  1. In case customization is needed, try triggering the Robot from Outlook Rules. Write a batch script which will trigger the jobs from outlook rules when the email arrives. Outlooks Rules And Alerts Run A Script

Create a VB script in Outlook to monitor incoming emails and when a new one appears in the Inbox to trigger a CMD command to run the Robot.

UiPath support does not build such scripts, but list some suggestions :

  1. Open the Outlook and press ALT+F11, it will open VB for application Studio
  2. In the Microsoft Outlook Objects select This Outlook session

  • Example presented in this website can be modified : How To Run A VBA Macro When New Mail Is Received In Outlook, instead of message box execute a CMD command to run the xaml file (Robot workflow that processes the email) , as in this example on how to run the xaml file from the command line "C:\Program Files (x86)\UiPath\Studio\UiRobot.exe" /file:"C:\Users\UserName\Documents\UiPath\LogProcess\Main.xaml"

Whenever the job is run from the command prompt and if the Robot is connected to Orchestrator it will only write the logs in the database, but the job will not be visible in the Orchestrator.

If jobs need to be logged to Orchestrator make use of API calls, so whenever a new email is received, make an API post to that specific job, the job will start from Orchestrator and it will be logged properly.

For more information about APIs access our documentation Building API Requests .

A post was split to a new topic: How to open command prompt and launch the xaml file?