How to send a mail using SMTP mail Message activity with the body has html format

I have created RPA challenge workflow using RE Framework (Dispatcher and Performer). If an exception occur i need to send an Email. I have set SMTP mail message activity in Set Transaction Status. The Rule for each field is different for first name should be more than 4 letter and phone number is not less than 10.
So i have send a mail if the business rule exception for the fields in table format. I have use HTML format.
If any knows the answer kindly help me…

@Vanitha_VS

Use Send SMTP Email activity. Enable Body as HTML

Now pass your HTML mail body in Body

Yes, It’s done.
But how to write the html code to write the exception info in table format

@Vanitha_VS

Store this html string in a text file.

<html>
<head>
<style>
table {
    border-collapse: collapse;
    width: 100%;
    font-family: Arial;
}
th, td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
}
th {
    background-color: #F2F2F2;
}
</style>
</head>
<body>

<p>Hello Team,</p>

<table>
<tr>
    <th>Process</th>
    <th>Status</th>
    <th>Run Date</th>
</tr>
<tr>
    <td>##processname##</td>
    <td>##status##</td>
    <td>##rundate##</td>
</tr>
</table>

<p>Regards,<br/>UiPath Bot</p>

</body>
</html>

before your send SMTP email activity just read the text file using Read Text file which will give you a string variable.

Now use assign activity to replace the placeholders in the string like ##processname## with actual value like

strMailTemplateFromFile = strMailTemplateFromFile.Replace("##processname##","Performer Bot").

Make the changes as per your need.

This is working fine when am hord coding. But i have saved this html code in UiPath and using in SMTP body as html. String.Format(in_Config(“EmailBodyhtml”).ToString, in_BusinessException.Message, io_TransactionNumber.Tostring)

Is this correct


This is my html code in Config file

@Vanitha_VS

Instead of string.format, place placeholders like I used and use string replace function to replace the placeholder string with actual value.

Thank you. this is working fine for me

The newer activities will mess up your HTML if you put it directly into the Body in the activity. You have to assign all your HTML to a variable and then use just that variable as an expression in Body.