How to use HTML code in email smtp

hello uipath family

I have to use HTML code in the body but the thing is inside that code I want to show the count of the email i.e some dynamical value I need to show
check the screenshot inbox mail is there actually that is variable how to show that value in that


Can anyone use that code I hope I get a Replay anyone

This is the code of HTML :point_down:

`<!doctype html>

Merit body { font-family: 'poppins'; font-size: 14px; }
<tr width="800">
    <td align="center" valign="top" height="200" style="background: linear-gradient(to right, #6aafe1 0%, #29bdd1 100%);">
        <h1 style="color: #fff;">STSK PropTech</h1>
        <p style="color: #fff;"><img src="https://drive.google.com/uc?id=1houwW1_JIu44bpfdoxj9gW20eQOcsIhR" alt="no" /> You have <span style="font-weight: bold;font-size: 20px;">{0}</span> unread Messages </p>
        <a href="https://www.google.com/intl/en-GB/gmail/about/" target="_blank" style="color: #fff;text-decoration: underline;">Please Check Here</a>
    </td>
   
</tr>
`

Thanks
Chethan P

Hi @copy_writes,

You can think of your HTML code as a simple string. An alternative approach is to keep your HTML code as its own separate template file with a placeholder string "NUMBEROFEMAILS". When you run the worfklow, you first read the contents of the template file and simply use
HTMLValue.Replace("NUMBEROFEMAILS", CountVariable.ToString)

Some advantages:

  • In the future if your template changes, your logic does not need to be changed.
  • You can update N number of changes to the HTML variable using this approach.

OR

If you cannot use a template file then you can get this by.Replace("NUMBEROFEMAILS", CountVariable.ToString) in your HTML variable.

In both cases you will need to known, which part of the HTML need to be replaced.

Here is a suggested workflow and the template file:
HTML_Replace.zip (2.0 KB)

Hope this helps!

3 Likes

Thank you very much I get the solution it was a simple way osm

Thanks
Chethan P

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