MailAddress to = new MailAddress(email); //sender email address MailAddress from = new MailAddress("xyz@gmail.com.com"); MailMessage msg = new MailMessage(); //use reason shown in grid msg.Subject = "Hello This For Test"; string textBody = "<table border=" + 1 + " cellpadding=" + 0 + " cellspacing=" + 0 + " width=" + 400 + "><tbody><tr><td>Name:'"+name.Text+"'</td> <td> Email:'"+email+"' </td><td>ContactNo:'"+contactNo.Text+"'</td></tr></tbody></table>"; msg.Body = textbody; msg.From = from; msg.To.Add(to); SmtpClient client = new SmtpClient(); client.Host = "smtpout.secureserver.net"; client.Port = 25; client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential("xyz@gmail.com", "01234"); try { client.Send(mail); } catch (Exception ex) { Console.WriteLine("{0} Exception caught.", ex); }
table
string textBody = "<table border=" + 1 + " cellpadding=" + 0 + " cellspacing=" + 0 + " width=" + 400 + "><tbody><tr><td>Name:'" + HttpUtility.HtmlEncode(name.Text) + "'</td><td>Email:'" + HttpUtility.HtmlEncode(email) + "'</td><td>ContactNo:'" + HttpUtility.HtmlEncode(contactNo.Text) + "'</td></tr></tbody></table>";
MailMessage msg = new MailMessage(); msg.IsBodyHTML=true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)