Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Hello Everyone,

 

In this tutorial, I would like to share how you can trigger email using SAP Intelligent Robotic Process Automation, aka, SAP iRPA.

 

Prerequisites:



  • Subscription to SAP Intelligent RPA service in SAP Cloud Platform

  • SAP iRPA On-Premise Component Setup (SAP desktop Studio and SAP Desktop Agent)

  • Desktop Agent Tenant Registration



 

Let's get started now.


 

Create New Project



  • Goto File > Create New Project or press “Ctrl + N





  • Fill in the mandatory details in the pop-up, I have maintained below details for my project

    • Project Name: SendEmail

    • Project Template: Project SAP iRPA v1.0 (pre-selected)

    • Title: Send Email

    • Client Name: SELF (As this was self-learning)




 

Add Outlook Library to the Project



  • Select File and click on Edit Project





  • Go-to Libraries and check Outlook Integration library





  • Click on Save


 

Create New Application and add Pages to it



  • Now let’s add application to our project

  • Click on Applications from Context menu





  • Right click on Application panel and click on Add New Application





  • Select “UIAutomation” in the technology and it will display list of all the Windows application running under “Applications”, as shown below



 

  • Select “Inbox” from the list and click on “Save and Capture Page”



            You can change the application name if you wish, I have kept it as it is

  • Click on Refresh icon beside Pages in the Capture Page pop-up, it will display list of open windows pages for the selected application (outlook in our case)



           You can give any page name, I have named it as pInbox

  • Selected page will be displayed inside your application as shown below



          As you can see currently the page pInbox is in red (error state) reason being we have not                    mentioned any criteria for our bot to recognize the page, let’s add criteria to the page

  • Right click on TITLE under Capture Data section and click on “Add to Criteria”. Criteria helps your bot to identify page





  • As soon as you add the criteria, page will turn into Green as shown below





  • Click on New Email on your captured page to select New Email button



          Once you select it, you will note that New Email is highlighted as blue

  • Right click on highlighted section and click on Associate to New Item





  • You can change the name of the selected items under Parameters, I have renamed it to btNewEmail





  • Now let’s capture a new page for New Email screen, before capturing the page please make sure you open New Email screen on your outlook

  • To capture new right-click on your application and select Capture a New Page





  • Select your new email screen under Pages and click on Scan and Capture. I have named the page as pWindowNewEmail



         *If you are not sure which page indicates your new email screen then open you screen beside            Capture Page screen and control + hover over the new email screen

  • Capture “Name” as the criteria for this page as shown below





  • Select “To” section and right click on it to Associate it to New Item





  • I have named the selection as edTo under the parameter section





  • Similarly capture Subject, mail content and Send button and associate them to new items. For my reference I have named them as edSubject, edBody and btSend




Create Workflow



  • Select Workflow under context menu





  • Right click on your application and click on New Workflow





  • Enter the workflow name and click on save, I will name it as sendEmail1





  • You will note a workflow has been created as below





  • Now we want to start our outlook application so for that we drag and drop Start Application under Activities to our workflow





  • Now click on Start under the workflow, go to properties and select your application under the Activity





  • Now connect Start to your Start Application flow in the workflow





  • Now go to Pages beside Activities, it will display all the pages you have created in your application as below





  • Drag and drop inbox page to the workflow and connect it to Start application





  • Double-click on your page inside the workflow to edit the Activities

  • Once you double-click, you will be navigated to the page activities section as shown below





  • Drag and drop Click activity under Item and attach it to New Email which was highlighted when we created page in our application and click on Save or press Ctrl + S





  • Now let’s go back to workflow designer by click on sendEmail hyperlink as below





  • Now let’s add our new email page to the workflow and connect it to Inbox page





  • Let’s edit new email activities by double-clicking on the page





  • Now let’s add activity to each of the highlighted section

  • Right click on highlighted section for To and click on Set ... in the item as we want our bot to set email id in this section





  • Now let’s set email id which we want bot to enter inside Source data under Activity section of Properties



           Note: Source data can also be used to pick the email id at runtime but in our scenario we are             hardcoding it to clear our concepts

  • Similarly set the item for Subject and Mail Content section as well

  • Once bot enters all the data we want it to wait for 2 seconds before clicking on Send button. To achieve this we will set Wait activity now

  • Drag and drop Delay from Flow- Wait to Activities section of your page and set the Delay to 2000 ms as shown below





  • Now right-click on Send button and select “Click on the item” and click on Save





  • Now come back to workflow designer and click on save

  • We have successfully designed the workflow for our bot



Execute the Bot



  • To execute our bot we first need to build and then run our project

  • Click on Build icon  or click Ctrl + B





  • Once Build is success, you will get message as below





  • Now click on Play icon or press F5 to debug the script

  • You will below messages in Desktop Debugger





  • Close outlook so that you can see execution starting from bot opening the outlook

  • Now right-click on Desktop Agent and click your workflow



 

Congratulations !!! You have successfully created iRPA bot to trigger email


 

Happy Learning 🙂

 

 
10 Comments
syawariyatapesh
Explorer
Thank you for this blog. Detailed explanation.
kunal_jauhari4
Explorer
Very well written  and explained .. keep writing Vinay

 
Well written!

How can i send mails with images inside the html body?
0 Kudos
Thanks Florian, you can use <img> tag in html template to achieve this.

 

Have a look at below blog

https://blogs.sap.com/2020/05/20/how-to-send-customized-email-with-email-template/

 

Regards,

Vinay
0 Kudos

Thanks for the link!
My problem is, that i do not have the image beforehand, since its a screenshot generated from the bot. so i can not base64 encode it with the website.

 

Regards

Florian

0 Kudos
Hi Vinay,

i am looking for a blog where i can read data from email body and store  it in variables.

i have a flow it reads all the email based on subject and results are appearing in debug mode.

can you help me with how to get the data present in body and store them in variables.

Example of email body:

Customer name:xxx

Age:25

Gender:Male

 

Thanks,

Avinash
0 Kudos
Hi Avinash,

 

Please check below blog if it helps

 

https://blogs.sap.com/2020/05/12/sap-intelligent-rpa-search-in-the-body-of-emails-for-key-words/

 

Regards,

Vinay
0 Kudos
Hi Florian,

 

I think you will have to handle it in the script. Using JS you can convert the image to base64, I have not tried it but I think it should work.

 

Let me know if this helps.

 

Regards,

Vinay
0 Kudos
Hi Vinay,

I'm new to SAP IRPA Thanks for this blog  very well written and explained ....I have followed all the steps you have mentioned in this blog build successfully but the problem is after execution unable to send mail ..can you please help me in this

Ruksar
sveabecker
Community Advocate
Community Advocate
0 Kudos

Hi there,


You have a question and need help by the community? Instead of posting here, it is more helpful for you, if you post your own question. Here is how to get started:




  1. Learn about asking and answering questions in SAP Community with this tutorial: https://developers.sap.com/tutorials/community-qa.html

  2. Ask your detailed question here: https://answers.sap.com/questions/ask.html

  3. Wait for a response.


That’s it. Thank you!


Best regards


Your SAP Community moderator

Labels in this area