Include HTML table in Mail Body with dynamic values

Hi,

I need to include an HTML table in mail body when the BOT is sending a mail after end of each process, below is the sample table attached is the HTML code for the tabular format.
image HTML_MailBoody_Text.html (563 Bytes)

Issue is that the values in the right columns are stored in variables which will keep changing for every flow.

Please can someone suggest how to achieve the process.

  1. Use variable in HTML file.
  2. Currently I am saving this text file in a location, using a read activity and passing the output in mail body property, but upon sending mail the mail body is having only the HTML tags.

Thanks in advance

Hi @Faraz_Subhani

Have you checked isbodyhtml property

@AshwinS2 Great!, I did not check that property, now I see tabular format coming in mail body but how to use variables, as I mentioned that The second column values are stored in variable and will keep changing with every flow.

Please use this as follows:

This appendLine activity will generate HTML report what you need at your specified path location. I have showed you how to use a variable in the same HTML code. this will attach dynamic values in each iteration in the HTML report. after completing all your iterations, then you can attach this final HTML report into your send email activity as an attachment.
Now, you just use same path in your email attachment location as a path variable (path variable should have full path of this generated HTML file.)
This will attach your report into your email.

Hope my inputs are useful.

1 Like

@rkelchuri Thanks for your suggestion.
I tried the steps you said but it’s not working for me, may be I’m doing something wrong.

  1. Firstly, even after putting the variable I am not getting the actual value, snip below
    image

  2. Secondly, if I am using append line, so for the next iteration it is appending full html text to the existing one, resulting in 2 tables in mail box.
    Attached Xaml.Main.xaml (5.9 KB)

Yes, this appenLine should execute only in 1st iteration. From 2nd iteration you should used appendLine activity for only each line html report. Not required to call this main template.

@rkelchuri I’m sorry, but I am not getting exactly and what about the variable not taking the actual value and printing the variable name itself as I showed in above screenshot.

@rkelchuri Any help with this, I have a company name stored in the variable CompanyName which I am using in my HTML code but while I receive the mail it shows the variable as output and not the value.
image

CompanyName.toString might be in between double quotes like this “CompanyName.ToString”.
please check once.

It should be like this “+CompanyName.ToString+”

1 Like

Thanks it worked:-)

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