Send mail with custom email body

Hi,

I have to send email with the below format in email body. I have the data in datatable.

  1. [Row1Column1] - [Row1Column2] value [Row1Column3] has been modified to [Column4]
  2. [Row2Column1] - [Row2Column2] value [Row2Column3] has been modified to [Column4]
    3 [Row3Column1] - [Row3Column2] value [Row3Column3] has been modified to [Column4]

Please help

Thanks!

1 Like

@Divya_Balasubramania

You can use an Int32 variable to looping all data in datatable
And please be noticed that datatable count index from 0, not 1
it means row1column1 = row(0)(0)

__intIndex = 0
__strMailBody = “”
__While intIndex < dtDataTable.Rows.Count()
______strMailBody = strMailBody + dtDataTable.Rows(intIndex)(0).ToString() + " - " + dtDataTable.Rows(intIndex)(1).ToString() + " value " + dtDataTable.Rows(intIndex)(2).ToString() + " has been modified to " + dtDataTable.Rows(intIndex)(3).ToString()
______intIndex = intIndex + 1