Help with HTML mail

Hi, i’m having trouble, i need my robot to send an email, the body contains an HTML code that needs to get some variables from UiPath, the problem is that my HTML is allocated inside an ExcelFile (this because some values or structure can change if someone needs to).
Inside an “Invoke Code” activity i want to do a Replace to read the variables inside the HTML code, the one that i have allocated inside the ExcelFile.

Hi @NightWing03,

Welcome to community.

Can you share details about the code?


1 Like

(post deleted by author)

Sure, my HTML code is the following

“Path” and “ExcelName” are inside the ExcelFile that has the variables (Path has the route were the robot saves some reports made and ExcelName Contains the name of the report created)

I need the robot to read the HTML code from the ExcelFile, put it into the body of the Send Outlook Mail Message and replace the %% for the actual value of the variables.

The code works if i just put it inside the body but if someone wants to change things from the design i’ll need to Publish the robot everytime a change is needed, in order to avoid it, that’s why i have the HTML code inside the ExcelFile and read it from there

Read the entire txt and add the replace function to the result you get.

If you created the template, add labels between %% signs.

For example;
After reading the txt file, you can use the replace function.

result.replace(“[ExcelName]”,“excel file name”)

1 Like

Hi, that’s the html code (i putted it inside a notepad for a better reading) but mine is inside an ExcelFile called “Config”, it has the HTML_Code as a variable, like this:

Hi @NightWing03,

That doesn’t prevent you from using the replace function. Indicate the fields you want to assign a variable to the html you positioned in the config with label.

Then you can manage these labels with the replace function.

Config(HTML_Code).toString.Replace(“[Label]”,“your variable”)

1 Like

Hi @NightWing03 ,

You do not require an Invoke Code Activity to replace the value. You could use String Replace Activity.

As the excel is a config file, I would guess it is already being read into a Dictionary variable Config. You could use this variable to access the HTML_Code value like below :


For Replacing the values in the HTML_Code, you could do the below :


Let us know what is your implementation method, If Config file is already being Read as a Dictionary or not/RE-Framework is being used.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.