DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Place", typeof(string));
dt.Rows.Add(“Raja”,”KanyaKumari”);
dt.Rows.Add(“Durai”,”KanyaKumari”);
string str1 = "", str2 = "",
str3 = "";
str2 = "<table border =1 bordercolor=black cellspacing=0
cellpadding=0 >";
str2 += "<tr><td width=100px
align=center><b>Name</b><b></td><td
width=100px
align=center><b>Place</b></td>>/tr>”;
foreach (DataRow
r in dt.Rows)
{
str2 += "<tr><td>
<font color=blue><i><center>" + r[0].ToString() +
"</center></i></font></td>";
str2 += "<td><font
color=blue><i><center>" + r[1].ToString() + "</center></i></font></td></tr>";
}
try
{
MailMessage
mailmsg = new MailMessage();
mailmsg.From = new
MailAddress("raja30march90@Gmail.com");
mailmsg.To.Add(raja30march90@Gmail.com);
mailmsg.CC.Add(raja30march90@Gmail.com);
mailmsg.Subject = "V-EnerTek
Expense WorkAllocated";
mailmsg.IsBodyHtml = true;
str1 = "<html><body>
<br/>" +
"<br/><b>"
+ “Example”</b> <br/>" +
"<br/>" +
"Name:
" + “Raja Durai+
"<br/>";
str3 = "<br/>"
+
"With
Regards,<br/>" + “Raja.S” + "<br/>"
+
"<br/>" +
"<br/>"
+
"<br/>" +
"</body></html>";
mailmsg.Body =
str1.ToString() + " " +
str2.ToString() + " " + str3.ToString();
SmtpClient smtpclt = new SmtpClient();
smtpclt.Host = "127.0.0.1";
smtpclt.Send(mailmsg);
}
No comments:
Post a Comment