How to send SMTP mail message in a Table format by capturing all the exception in one mail

Hi,
I have created RPA challenge workflow using Re Framework. So each row in the excel (Input) I have set a wrong data at least for one field. So i need to capture all the row business rule exception and send it at the completion of the workflow not for every single row. How to send that mail after all the rows completion and in a table format that should be in HTML format.

@Vanitha_VS Yes, you can do this.

Do not send the email inside each transaction.
Instead, whenever a row fails with a Business Rule Exception, save that row’s details into a DataTable/List.

After all rows are completed:

  • check whether the DataTable has rows

  • convert it to an HTML table

  • send one email using Send SMTP Mail Message

  • set IsBodyHtml = True

Best place in REFramework:

  • collect failures in Process Transaction

  • send the final summary email in End Process

This is the cleanest way to send one consolidated exception report.

how to convert data table to html table

@Vanitha_VS Create a String variable β†’ htmlBody

Then use this in an Assign activity:

htmlBody = β€œβ€ + β€œβ€ + String.Join(β€œβ€, dt.Columns.Cast(Of DataColumn).Select(Function(c) β€œβ€ + c.ColumnName + β€œβ€)) + β€œβ€ + String.Join(β€œβ€, dt.AsEnumerable().Select(Function(row) β€œβ€ + String.Join(β€œβ€, row.ItemArray.Select(Function(cell) β€œβ€ + cell.ToString + β€œβ€)) + β€œβ€)) + β€œβ€

In Send SMTP Mail Message:

  • Body β†’ htmlBody

  • Set IsBodyHtml = True

Hi @Vanitha_VS ,

You may refer this post , it is having the complete code.

Try attached workflow
DatatableToHtml.xaml (10.0 KB)

Cheers

Hi @Vanitha_VS

You could install this package from @lakshman in the Marketplace that has a lot of activities for manipulating datatables - among others DataTable to HTML.

This should make it easy to accomplish what you are trying to do.

Regards
Soren

@Vanitha_VS

Check above reference