Is it possible to send a table (coded in html) as the body of an email so that the recipient is able to view the table (parsed and displayed).
For example, I want to be able to send this as the body of an email:
<html>
<table>
<tr>
<td> col1 </td>
<td> col2 </td>
</tr>
</table>
</html>
So that the recipient sees col1 col2
.
I've read in some places that it's not possible and that I must use the table creator provided by the email service, but I'd just like to confirm to see if it's possible or not.
This will depend on the recipient's email client. Some display in HTML, others only display plain text.
You can not directly use HTML
or Body
tag when you embedding HTML in c#
string as it already going to display inside HTML
Page. Below is a simple table format.
body += "<table align ='center'>"
body += "<tr>"
body += "<td align = 'right' > Name : </td>"
body += "<td >" + Name + "</td>"
body += "</tr>"
body += "<tr>"
body += "<td align = 'right' > Application ID :</td>"
body += "<td >" + ApplicationID + "</td>"
body += "</tr>"
body += "<tr>"
body += "<td align = 'right' > Passport No :</td>"
body += "<td >" + PassportNo + " </td>"
body += "</tr>"
body += "<tr>"
body += "<td align = 'right' > Voucher No. :</td>"
body += "<td >" + VoucherNo + "</td>"
body += "</tr>"
body += "<tr>"
body += "<td align = 'right' > Date : </td>"
body += "<td >" + PDate + "</td>"
body += "</tr>"
body += "</table><br>"
You can also do styling like below
Example
body+="<td style='padding:10px; height:20px; width=200px'>Hello World!</td>"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With